aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/nvim/arabic.c2
-rw-r--r--src/nvim/autocmd.c7
-rw-r--r--src/nvim/buffer.c13
-rw-r--r--src/nvim/buffer_updates.c1
-rw-r--r--src/nvim/context.c2
-rw-r--r--src/nvim/cursor_shape.c3
-rw-r--r--src/nvim/diff.c2
-rw-r--r--src/nvim/digraph.c2
-rw-r--r--src/nvim/ex_cmds.lua2
-rw-r--r--src/nvim/ex_docmd.c47
-rw-r--r--src/nvim/ex_getln.c2
-rw-r--r--src/nvim/globals.h3
-rw-r--r--src/nvim/highlight_defs.h2
-rw-r--r--src/nvim/highlight_group.c2
-rw-r--r--src/nvim/match.c12
-rw-r--r--src/nvim/move.c16
-rw-r--r--src/nvim/option.c23
-rw-r--r--src/nvim/syntax.c4
-rw-r--r--src/nvim/testdir/test_filetype.vim24
-rw-r--r--src/nvim/testdir/test_options.vim8
-rw-r--r--src/nvim/testdir/test_syntax.vim13
-rw-r--r--src/nvim/tui/tui.c19
22 files changed, 152 insertions, 57 deletions
diff --git a/src/nvim/arabic.c b/src/nvim/arabic.c
index 5dcc3d3d0d..db78e0e68f 100644
--- a/src/nvim/arabic.c
+++ b/src/nvim/arabic.c
@@ -974,6 +974,7 @@ int arabic_shape(int c, int *ccp, int *c1p, int prev_c, int prev_c1, int next_c)
/// @param one First character.
/// @param two Character just after "one".
bool arabic_combine(int one, int two)
+ FUNC_ATTR_PURE
{
if (one == a_LAM) {
return arabic_maycombine(two);
@@ -984,6 +985,7 @@ bool arabic_combine(int one, int two)
/// Check whether we are dealing with a character that could be regarded as an
/// Arabic combining character, need to check the character before this.
bool arabic_maycombine(int two)
+ FUNC_ATTR_PURE
{
if (p_arshape && !p_tbidi) {
return two == a_ALEF_MADDA
diff --git a/src/nvim/autocmd.c b/src/nvim/autocmd.c
index 1b146f82c6..77d4115b59 100644
--- a/src/nvim/autocmd.c
+++ b/src/nvim/autocmd.c
@@ -379,6 +379,7 @@ static void au_cleanup(void)
// Get the first AutoPat for a particular event.
AutoPat *au_get_autopat_for_event(event_T event)
+ FUNC_ATTR_PURE
{
return first_autopat[(int)event];
}
@@ -1143,6 +1144,7 @@ int autocmd_register(int64_t id, event_T event, char_u *pat, int patlen, int gro
}
size_t aucmd_pattern_length(char_u *pat)
+ FUNC_ATTR_PURE
{
if (*pat == NUL) {
return 0;
@@ -1175,6 +1177,7 @@ size_t aucmd_pattern_length(char_u *pat)
}
char_u *aucmd_next_pattern(char_u *pat, size_t patlen)
+ FUNC_ATTR_PURE
{
pat = pat + patlen;
if (*pat == ',') {
@@ -2383,6 +2386,7 @@ theend:
// Checks if a pattern is buflocal
bool aupat_is_buflocal(char_u *pat, int patlen)
+ FUNC_ATTR_PURE
{
return patlen >= 8
&& STRNCMP(pat, "<buffer", 7) == 0
@@ -2492,6 +2496,7 @@ char *aucmd_exec_default_desc(AucmdExecutable acc)
}
char *aucmd_exec_to_string(AutoCmd *ac, AucmdExecutable acc)
+ FUNC_ATTR_PURE
{
switch (acc.type) {
case CALLABLE_EX:
@@ -2542,6 +2547,7 @@ AucmdExecutable aucmd_exec_copy(AucmdExecutable src)
}
bool aucmd_exec_is_deleted(AucmdExecutable acc)
+ FUNC_ATTR_PURE
{
switch (acc.type) {
case CALLABLE_EX:
@@ -2556,6 +2562,7 @@ bool aucmd_exec_is_deleted(AucmdExecutable acc)
}
bool au_event_is_empty(event_T event)
+ FUNC_ATTR_PURE
{
return first_autopat[event] == NULL;
}
diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c
index 4948e2bb69..4d914acea4 100644
--- a/src/nvim/buffer.c
+++ b/src/nvim/buffer.c
@@ -1775,19 +1775,6 @@ buf_T *buflist_new(char_u *ffname_arg, char_u *sfname_arg, linenr_T lnum, int fl
clear_wininfo(buf);
buf->b_wininfo = xcalloc(1, sizeof(wininfo_T));
- if (ffname != NULL && (buf->b_ffname == NULL || buf->b_sfname == NULL)) {
- if (buf->b_sfname != buf->b_ffname) {
- XFREE_CLEAR(buf->b_sfname);
- } else {
- buf->b_sfname = NULL;
- }
- XFREE_CLEAR(buf->b_ffname);
- if (buf != curbuf) {
- free_buffer(buf);
- }
- return NULL;
- }
-
if (buf == curbuf) {
// free all things allocated for this buffer
buf_freeall(buf, 0);
diff --git a/src/nvim/buffer_updates.c b/src/nvim/buffer_updates.c
index ee1b7ebc95..3e2d04b3a2 100644
--- a/src/nvim/buffer_updates.c
+++ b/src/nvim/buffer_updates.c
@@ -84,6 +84,7 @@ bool buf_updates_register(buf_T *buf, uint64_t channel_id, BufUpdateCallbacks cb
}
bool buf_updates_active(buf_T *buf)
+ FUNC_ATTR_PURE
{
return kv_size(buf->update_channels) || kv_size(buf->update_callbacks);
}
diff --git a/src/nvim/context.c b/src/nvim/context.c
index 9434b4e0ea..c30a05a3c8 100644
--- a/src/nvim/context.c
+++ b/src/nvim/context.c
@@ -33,6 +33,7 @@ void ctx_free_all(void)
/// Returns the size of the context stack.
size_t ctx_size(void)
+ FUNC_ATTR_PURE
{
return kv_size(ctx_stack);
}
@@ -40,6 +41,7 @@ size_t ctx_size(void)
/// Returns pointer to Context object with given zero-based index from the top
/// of context stack or NULL if index is out of bounds.
Context *ctx_get(size_t index)
+ FUNC_ATTR_PURE
{
if (index < kv_size(ctx_stack)) {
return &kv_Z(ctx_stack, index);
diff --git a/src/nvim/cursor_shape.c b/src/nvim/cursor_shape.c
index 0e4a4bcfb0..73adff6579 100644
--- a/src/nvim/cursor_shape.c
+++ b/src/nvim/cursor_shape.c
@@ -277,6 +277,7 @@ char *parse_shape_opt(int what)
///
/// @param exclusive If 'selection' option is "exclusive".
bool cursor_is_block_during_visual(bool exclusive)
+ FUNC_ATTR_PURE
{
int mode_idx = exclusive ? SHAPE_IDX_VE : SHAPE_IDX_V;
return (SHAPE_BLOCK == shape_table[mode_idx].shape
@@ -300,6 +301,7 @@ int cursor_mode_str2int(const char *mode)
/// Check if a syntax id is used as a cursor style.
bool cursor_mode_uses_syn_id(int syn_id)
+ FUNC_ATTR_PURE
{
if (*p_guicursor == NUL) {
return false;
@@ -316,6 +318,7 @@ bool cursor_mode_uses_syn_id(int syn_id)
/// Return the index into shape_table[] for the current mode.
int cursor_get_mode_idx(void)
+ FUNC_ATTR_PURE
{
if (State == SHOWMATCH) {
return SHAPE_IDX_SM;
diff --git a/src/nvim/diff.c b/src/nvim/diff.c
index 0b55fb877c..9e8fa2e62d 100644
--- a/src/nvim/diff.c
+++ b/src/nvim/diff.c
@@ -883,6 +883,7 @@ theend:
/// diff will be used anyway.
///
int diff_internal(void)
+ FUNC_ATTR_PURE
{
return (diff_flags & DIFF_INTERNAL) != 0 && *p_dex == NUL;
}
@@ -2250,6 +2251,7 @@ bool diffopt_horizontal(void)
// Return true if 'diffopt' contains "hiddenoff".
bool diffopt_hiddenoff(void)
+ FUNC_ATTR_PURE
{
return (diff_flags & DIFF_HIDDEN_OFF) != 0;
}
diff --git a/src/nvim/digraph.c b/src/nvim/digraph.c
index 083c868607..0e148543aa 100644
--- a/src/nvim/digraph.c
+++ b/src/nvim/digraph.c
@@ -1551,6 +1551,7 @@ int get_digraph(bool cmdline)
/// @return If no match, return "char2". If "meta_char" is true and "char1"
// is a space, return "char2" | 0x80.
static int getexactdigraph(int char1, int char2, bool meta_char)
+ FUNC_ATTR_PURE
{
int retval = 0;
@@ -1601,6 +1602,7 @@ static int getexactdigraph(int char1, int char2, bool meta_char)
///
/// @return The digraph.
int digraph_get(int char1, int char2, bool meta_char)
+ FUNC_ATTR_PURE
{
int retval;
diff --git a/src/nvim/ex_cmds.lua b/src/nvim/ex_cmds.lua
index c2d40c8bb7..427e018141 100644
--- a/src/nvim/ex_cmds.lua
+++ b/src/nvim/ex_cmds.lua
@@ -2947,7 +2947,7 @@ module.cmds = {
},
{
command='undo',
- flags=bit.bor(RANGE, COUNT, ZEROR, TRLBAR, CMDWIN),
+ flags=bit.bor(BANG, RANGE, COUNT, ZEROR, TRLBAR, CMDWIN),
addr_type='ADDR_OTHER',
func='ex_undo',
},
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c
index cbfe6e3789..b67754ffe5 100644
--- a/src/nvim/ex_docmd.c
+++ b/src/nvim/ex_docmd.c
@@ -76,6 +76,7 @@
#include "nvim/terminal.h"
#include "nvim/ui.h"
#include "nvim/undo.h"
+#include "nvim/undo_defs.h"
#include "nvim/version.h"
#include "nvim/vim.h"
#include "nvim/window.h"
@@ -2373,8 +2374,13 @@ int parse_cmd_address(exarg_T *eap, char **errormsg, bool silent)
switch (eap->addr_type) {
case ADDR_LINES:
case ADDR_OTHER:
- // default is current line number
- eap->line2 = curwin->w_cursor.lnum;
+ // Default is the cursor line number. Avoid using an invalid
+ // line number though.
+ if (curwin->w_cursor.lnum > curbuf->b_ml.ml_line_count) {
+ eap->line2 = curbuf->b_ml.ml_line_count;
+ } else {
+ eap->line2 = curwin->w_cursor.lnum;
+ }
break;
case ADDR_WINDOWS:
eap->line2 = CURRENT_WIN_NR;
@@ -8226,10 +8232,39 @@ static void ex_bang(exarg_T *eap)
/// ":undo".
static void ex_undo(exarg_T *eap)
{
- if (eap->addr_count == 1) { // :undo 123
- undo_time(eap->line2, false, false, true);
- } else {
- u_undo(1);
+ if (eap->addr_count != 1) {
+ if (eap->forceit) {
+ u_undo_and_forget(1); // :undo!
+ } else {
+ u_undo(1); // :undo
+ }
+ return;
+ }
+
+ long step = eap->line2;
+
+ if (eap->forceit) { // undo! 123
+ // change number for "undo!" must be lesser than current change number
+ if (step >= curbuf->b_u_seq_cur) {
+ emsg(_(e_undobang_cannot_redo_or_move_branch));
+ return;
+ }
+ // ensure that target change number is in same branch
+ // while also counting the amount of undoes it'd take to reach target
+ u_header_T *uhp;
+ int count = 0;
+
+ for (uhp = curbuf->b_u_curhead ? curbuf->b_u_curhead : curbuf->b_u_newhead;
+ uhp != NULL && uhp->uh_seq > step;
+ uhp = uhp->uh_next.ptr, ++count) {
+ }
+ if (step != 0 && (uhp == NULL || uhp->uh_seq < step)) {
+ emsg(_(e_undobang_cannot_redo_or_move_branch));
+ return;
+ }
+ u_undo_and_forget(count);
+ } else { // :undo 123
+ undo_time(step, false, false, true);
}
}
diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c
index 49bd8e7b21..91e93a236a 100644
--- a/src/nvim/ex_getln.c
+++ b/src/nvim/ex_getln.c
@@ -2604,6 +2604,7 @@ char_u *getexline(int c, void *cookie, int indent, bool do_concat)
}
bool cmdline_overstrike(void)
+ FUNC_ATTR_PURE
{
return ccline.overstrike;
}
@@ -2611,6 +2612,7 @@ bool cmdline_overstrike(void)
/// Return true if the cursor is at the end of the cmdline.
bool cmdline_at_end(void)
+ FUNC_ATTR_PURE
{
return (ccline.cmdpos >= ccline.cmdlen);
}
diff --git a/src/nvim/globals.h b/src/nvim/globals.h
index 2b85b6a208..e07a0e22ca 100644
--- a/src/nvim/globals.h
+++ b/src/nvim/globals.h
@@ -1013,6 +1013,9 @@ EXTERN char e_line_number_out_of_range[] INIT(= N_("E1247: Line number out of ra
EXTERN char e_highlight_group_name_too_long[] INIT(= N_("E1249: Highlight group name too long"));
+EXTERN char e_undobang_cannot_redo_or_move_branch[]
+INIT(= N_("E5767: Cannot use :undo! to redo or move to a different undo branch"));
+
EXTERN char top_bot_msg[] INIT(= N_("search hit TOP, continuing at BOTTOM"));
EXTERN char bot_top_msg[] INIT(= N_("search hit BOTTOM, continuing at TOP"));
diff --git a/src/nvim/highlight_defs.h b/src/nvim/highlight_defs.h
index e0ee649013..0515842b61 100644
--- a/src/nvim/highlight_defs.h
+++ b/src/nvim/highlight_defs.h
@@ -63,6 +63,7 @@ typedef enum {
HLF_E, // error messages
HLF_I, // incremental search
HLF_L, // last search string
+ HLF_LC, // current search match
HLF_M, // "--More--" message
HLF_CM, // Mode (e.g., "-- INSERT --")
HLF_N, // line number for ":number" and ":#" commands
@@ -123,6 +124,7 @@ EXTERN const char *hlf_names[] INIT(= {
[HLF_E] = "ErrorMsg",
[HLF_I] = "IncSearch",
[HLF_L] = "Search",
+ [HLF_LC] = "CurSearch",
[HLF_M] = "MoreMsg",
[HLF_CM] = "ModeMsg",
[HLF_N] = "LineNr",
diff --git a/src/nvim/highlight_group.c b/src/nvim/highlight_group.c
index 3092aaefab..a9ced84280 100644
--- a/src/nvim/highlight_group.c
+++ b/src/nvim/highlight_group.c
@@ -1927,7 +1927,7 @@ void highlight_changed(void)
}
highlight_attr[hlf] = hl_get_ui_attr(hlf, final_id,
- hlf == HLF_INACTIVE);
+ (hlf == HLF_INACTIVE || hlf == HLF_LC));
if (highlight_attr[hlf] != highlight_attr_last[hlf]) {
if (hlf == HLF_MSG) {
diff --git a/src/nvim/match.c b/src/nvim/match.c
index af89319a09..4129e84fc2 100644
--- a/src/nvim/match.c
+++ b/src/nvim/match.c
@@ -4,6 +4,7 @@
// match.c: functions for highlighting matches
#include <stdbool.h>
+#include "nvim/buffer_defs.h"
#include "nvim/charset.h"
#include "nvim/fold.h"
#include "nvim/highlight_group.h"
@@ -667,7 +668,16 @@ int update_search_hl(win_T *wp, linenr_T lnum, colnr_T col, char_u **line, match
if (shl->endcol < next_col) {
shl->endcol = next_col;
}
- shl->attr_cur = shl->attr;
+ // Use "CurSearch" highlight for current search match
+ if (shl == search_hl
+ && (HL_ATTR(HLF_LC) || wp->w_hl_ids[HLF_LC])
+ && wp->w_cursor.lnum == lnum
+ && wp->w_cursor.col >= shl->startcol
+ && wp->w_cursor.col < shl->endcol) {
+ shl->attr_cur = win_hl_attr(wp, HLF_LC) ? win_hl_attr(wp, HLF_LC) : HL_ATTR(HLF_LC);
+ } else {
+ shl->attr_cur = shl->attr;
+ }
// Match with the "Conceal" group results in hiding
// the match.
if (cur != NULL
diff --git a/src/nvim/move.c b/src/nvim/move.c
index eda3298101..c55a9a296b 100644
--- a/src/nvim/move.c
+++ b/src/nvim/move.c
@@ -95,27 +95,31 @@ static void comp_botline(win_T *wp)
win_check_anchored_floats(wp);
}
-/// Redraw when w_cline_row changes and 'relativenumber' or 'cursorline' is set.
+/// Redraw when w_cline_row changes and 'relativenumber' or 'cursorline' is set
+/// or if the 'CurSearch' highlight is defined.
/// Also when concealing is on and 'concealcursor' is not active.
void redraw_for_cursorline(win_T *wp)
FUNC_ATTR_NONNULL_ALL
{
if ((wp->w_valid & VALID_CROW) == 0 && !pum_visible()
- && (wp->w_p_rnu || win_cursorline_standout(wp))) {
- // win_line() will redraw the number column and cursorline only.
+ && (wp->w_p_rnu || win_cursorline_standout(wp)
+ || HL_ATTR(HLF_LC) || wp->w_hl_ids[HLF_LC])) {
+ // win_line() will redraw the number column and cursorline only
+ // and also update the CurSearch highlight (if needed).
redraw_later(wp, VALID);
}
}
/// Redraw when w_virtcol changes and 'cursorcolumn' is set or 'cursorlineopt'
-/// contains "screenline".
+/// contains "screenline" or when the 'CurSearch' highlight is defined.
/// Also when concealing is on and 'concealcursor' is active.
static void redraw_for_cursorcolumn(win_T *wp)
FUNC_ATTR_NONNULL_ALL
{
if ((wp->w_valid & VALID_VIRTCOL) == 0 && !pum_visible()) {
- if (wp->w_p_cuc) {
- // When 'cursorcolumn' is set need to redraw with SOME_VALID.
+ if (wp->w_p_cuc || HL_ATTR(HLF_LC) || wp->w_hl_ids[HLF_LC]) {
+ // When 'cursorcolumn' is set or 'CurSearch' is defined
+ // need to redraw with SOME_VALID.
redraw_later(wp, SOME_VALID);
} else if (wp->w_p_cul && (wp->w_p_culopt_flags & CULOPT_SCRLINE)) {
// When 'cursorlineopt' contains "screenline" need to redraw with VALID.
diff --git a/src/nvim/option.c b/src/nvim/option.c
index c073c6d71b..3aa76f7767 100644
--- a/src/nvim/option.c
+++ b/src/nvim/option.c
@@ -335,6 +335,9 @@ static char_u SHM_ALL[] = {
0,
};
+static char e_unclosed_expression_sequence[] = N_("E540: Unclosed expression sequence");
+static char e_unbalanced_groups[] = N_("E542: unbalanced groups");
+
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "option.c.generated.h"
#endif
@@ -2918,8 +2921,8 @@ ambw_end:
curbuf->b_help = (curbuf->b_p_bt[0] == 'h');
redraw_titles();
}
- } else if (gvarp == &p_stl || varp == &p_ruf) {
- // 'statusline' or 'rulerformat'
+ } else if (gvarp == &p_stl || varp == &p_tal || varp == &p_ruf) {
+ // 'statusline', 'tabline' or 'rulerformat'
int wid;
if (varp == &p_ruf) { // reset ru_wid first
@@ -2938,7 +2941,7 @@ ambw_end:
errmsg = check_stl_option(p_ruf);
}
} else if (varp == &p_ruf || s[0] != '%' || s[1] != '!') {
- // check 'statusline' only if it doesn't start with "%!"
+ // check 'statusline' or 'tabline' only if it doesn't start with "%!"
errmsg = check_stl_option(s);
}
if (varp == &p_ruf && errmsg == NULL) {
@@ -3724,7 +3727,7 @@ static char *set_chars_option(win_T *wp, char_u **varp, bool set)
}
/// Check validity of options with the 'statusline' format.
-/// Return error message or NULL.
+/// Return an untranslated error message or NULL.
char *check_stl_option(char_u *s)
{
int groupdepth = 0;
@@ -3773,18 +3776,22 @@ char *check_stl_option(char_u *s)
return illegal_char(errbuf, sizeof(errbuf), *s);
}
if (*s == '{') {
- int reevaluate = (*s == '%');
- s++;
+ bool reevaluate = (*++s == '%');
+
+ if (reevaluate && *++s == '}') {
+ // "}" is not allowed immediately after "%{%"
+ return illegal_char(errbuf, sizeof(errbuf), '}');
+ }
while ((*s != '}' || (reevaluate && s[-1] != '%')) && *s) {
s++;
}
if (*s != '}') {
- return N_("E540: Unclosed expression sequence");
+ return e_unclosed_expression_sequence;
}
}
}
if (groupdepth != 0) {
- return N_("E542: unbalanced groups");
+ return e_unbalanced_groups;
}
return NULL;
}
diff --git a/src/nvim/syntax.c b/src/nvim/syntax.c
index d884ad704b..0ceb66f438 100644
--- a/src/nvim/syntax.c
+++ b/src/nvim/syntax.c
@@ -5802,8 +5802,8 @@ char_u *get_syntax_name(expand_T *xp, int idx)
int syn_get_id(win_T *wp, long lnum, colnr_T col, int trans, bool *spellp, int keep_state)
{
// When the position is not after the current position and in the same
- // line of the same buffer, need to restart parsing.
- if (wp->w_buffer != syn_buf || lnum != current_lnum || col < current_col) {
+ // line of the same window with the same buffer, need to restart parsing.
+ if (wp != syn_win || wp->w_buffer != syn_buf || lnum != current_lnum || col < current_col) {
syntax_start(wp, lnum);
} else if (col > current_col) {
// next_match may not be correct when moving around, e.g. with the
diff --git a/src/nvim/testdir/test_filetype.vim b/src/nvim/testdir/test_filetype.vim
index 85d9a75824..f2e635004e 100644
--- a/src/nvim/testdir/test_filetype.vim
+++ b/src/nvim/testdir/test_filetype.vim
@@ -113,7 +113,7 @@ let s:filename_checks = {
\ 'cobol': ['file.cbl', 'file.cob', 'file.lib'],
\ 'coco': ['file.atg'],
\ 'conaryrecipe': ['file.recipe'],
- \ 'conf': ['auto.master'],
+ \ 'conf': ['/etc/pacman.conf', 'any/etc/pacman.conf', 'auto.master'],
\ 'config': ['configure.in', 'configure.ac', '/etc/hostname.file'],
\ 'context': ['tex/context/any/file.tex', 'file.mkii', 'file.mkiv', 'file.mkvi', 'file.mkxl', 'file.mklx'],
\ 'cook': ['file.cook'],
@@ -152,7 +152,7 @@ let s:filename_checks = {
\ 'dnsmasq': ['/etc/dnsmasq.conf', '/etc/dnsmasq.d/file', 'any/etc/dnsmasq.conf', 'any/etc/dnsmasq.d/file'],
\ 'dockerfile': ['Containerfile', 'Dockerfile', 'file.Dockerfile', 'Dockerfile.debian', 'Containerfile.something'],
\ 'dosbatch': ['file.bat'],
- \ 'dosini': ['.editorconfig', '/etc/pacman.conf', '/etc/yum.conf', 'file.ini', 'npmrc', '.npmrc', 'php.ini', 'php.ini-5', 'php.ini-file', '/etc/yum.repos.d/file', 'any/etc/pacman.conf', 'any/etc/yum.conf', 'any/etc/yum.repos.d/file', 'file.wrap'],
+ \ 'dosini': ['.editorconfig', '/etc/yum.conf', 'file.ini', 'npmrc', '.npmrc', 'php.ini', 'php.ini-5', 'php.ini-file', '/etc/yum.repos.d/file', 'any/etc/yum.conf', 'any/etc/yum.repos.d/file', 'file.wrap'],
\ 'dot': ['file.dot', 'file.gv'],
\ 'dracula': ['file.drac', 'file.drc', 'filelvs', 'filelpe', 'drac.file', 'lpe', 'lvs', 'some-lpe', 'some-lvs'],
\ 'dtd': ['file.dtd'],
@@ -306,6 +306,7 @@ let s:filename_checks = {
\ 'libao': ['/etc/libao.conf', '/.libao', 'any/.libao', 'any/etc/libao.conf'],
\ 'lifelines': ['file.ll'],
\ 'lilo': ['lilo.conf', 'lilo.conf-file'],
+ \ 'lilypond': ['file.ly', 'file.ily'],
\ 'limits': ['/etc/limits', '/etc/anylimits.conf', '/etc/anylimits.d/file.conf', '/etc/limits.conf', '/etc/limits.d/file.conf', '/etc/some-limits.conf', '/etc/some-limits.d/file.conf', 'any/etc/limits', 'any/etc/limits.conf', 'any/etc/limits.d/file.conf', 'any/etc/some-limits.conf', 'any/etc/some-limits.d/file.conf'],
\ 'liquid': ['file.liquid'],
\ 'lisp': ['file.lsp', 'file.lisp', 'file.asd', 'file.el', 'file.cl', '.emacs', '.sawfishrc', 'sbclrc', '.sbclrc'],
@@ -383,6 +384,7 @@ let s:filename_checks = {
\ 'omnimark': ['file.xom', 'file.xin'],
\ 'opam': ['opam', 'file.opam', 'file.opam.template'],
\ 'openroad': ['file.or'],
+ \ 'openscad': ['file.scad'],
\ 'ora': ['file.ora'],
\ 'org': ['file.org', 'file.org_archive'],
\ 'pamconf': ['/etc/pam.conf', '/etc/pam.d/file', 'any/etc/pam.conf', 'any/etc/pam.d/file'],
@@ -743,7 +745,7 @@ func Test_setfiletype_completion()
endfunc
"""""""""""""""""""""""""""""""""""""""""""""""""
-" Tests for specific extentions and filetypes.
+" Tests for specific extensions and filetypes.
" Keep sorted.
"""""""""""""""""""""""""""""""""""""""""""""""""
@@ -1171,12 +1173,12 @@ func Test_hook_file()
call writefile(['[Trigger]', 'this is pacman config'], 'Xfile.hook')
split Xfile.hook
- call assert_equal('dosini', &filetype)
+ call assert_equal('conf', &filetype)
bwipe!
call writefile(['not pacman'], 'Xfile.hook')
split Xfile.hook
- call assert_notequal('dosini', &filetype)
+ call assert_notequal('conf', &filetype)
bwipe!
call delete('Xfile.hook')
@@ -1535,11 +1537,13 @@ func Test_src_file()
bwipe!
call delete('srcfile.Src')
- " KRL global def with embedded spaces, file starts with empty line(s).
- call writefile(['', 'global def srcfile()'], 'srcfile.SRC')
- split srcfile.SRC
- call assert_equal('krl', &filetype)
- bwipe!
+ " KRL global deffct with embedded spaces, file starts with empty line(s).
+ for text in ['global def srcfile()', 'global deffct srcfile()']
+ call writefile(['', text], 'srcfile.SRC')
+ split srcfile.SRC
+ call assert_equal('krl', &filetype, text)
+ bwipe!
+ endfor
" User may overrule file inspection
let g:filetype_src = 'src'
diff --git a/src/nvim/testdir/test_options.vim b/src/nvim/testdir/test_options.vim
index 8612b7013b..d16d89ec2e 100644
--- a/src/nvim/testdir/test_options.vim
+++ b/src/nvim/testdir/test_options.vim
@@ -281,8 +281,16 @@ func Test_set_errors()
call assert_fails('set rulerformat=%15(%%', 'E542:')
call assert_fails('set statusline=%$', 'E539:')
call assert_fails('set statusline=%{', 'E540:')
+ call assert_fails('set statusline=%{%', 'E540:')
+ call assert_fails('set statusline=%{%}', 'E539:')
call assert_fails('set statusline=%(', 'E542:')
call assert_fails('set statusline=%)', 'E542:')
+ call assert_fails('set tabline=%$', 'E539:')
+ call assert_fails('set tabline=%{', 'E540:')
+ call assert_fails('set tabline=%{%', 'E540:')
+ call assert_fails('set tabline=%{%}', 'E539:')
+ call assert_fails('set tabline=%(', 'E542:')
+ call assert_fails('set tabline=%)', 'E542:')
if has('cursorshape')
" This invalid value for 'guicursor' used to cause Vim to crash.
diff --git a/src/nvim/testdir/test_syntax.vim b/src/nvim/testdir/test_syntax.vim
index b047b53b6f..6bef61ae8f 100644
--- a/src/nvim/testdir/test_syntax.vim
+++ b/src/nvim/testdir/test_syntax.vim
@@ -794,5 +794,18 @@ func Test_syn_include_contains_TOP()
bw!
endfunc
+" This was using freed memory
+func Test_WinEnter_synstack_synID()
+ autocmd WinEnter * call synstack(line("."), col("."))
+ autocmd WinEnter * call synID(line('.'), col('.') - 1, 1)
+ call setline(1, 'aaaaa')
+ normal! $
+ new
+ close
+
+ au! WinEnter
+ bw!
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab
diff --git a/src/nvim/tui/tui.c b/src/nvim/tui/tui.c
index a67bcf98dc..4b5ad4cff8 100644
--- a/src/nvim/tui/tui.c
+++ b/src/nvim/tui/tui.c
@@ -311,8 +311,7 @@ static void terminfo_start(UI *ui)
// Enable bracketed paste
unibi_out_ext(ui, data->unibi_ext.enable_bracketed_paste);
- // Enable extended keys (also known as 'modifyOtherKeys' or CSI u). On terminals that don't
- // support this, this sequence is ignored.
+ // Enable extended keys (also known as 'modifyOtherKeys' or CSI u)
unibi_out_ext(ui, data->unibi_ext.enable_extended_keys);
int ret;
@@ -2075,13 +2074,15 @@ static void augment_terminfo(TUIData *data, const char *term, long vte_version,
"\x1b[58:2::%p1%d:%p2%d:%p3%dm");
}
- if (!kitty) {
- // Kitty does not support these sequences; it only supports it's own CSI > 1 u which enables the
- // Kitty keyboard protocol
- data->unibi_ext.enable_extended_keys = (int)unibi_add_ext_str(ut, "ext.enable_extended_keys",
- "\x1b[>4;2m");
- data->unibi_ext.disable_extended_keys = (int)unibi_add_ext_str(ut, "ext.disable_extended_keys",
- "\x1b[>4;0m");
+ data->unibi_ext.enable_extended_keys = unibi_find_ext_str(ut, "Eneks");
+ data->unibi_ext.disable_extended_keys = unibi_find_ext_str(ut, "Dseks");
+ if (data->unibi_ext.enable_extended_keys == -1) {
+ if (!kitty && (vte_version == 0 || vte_version >= 5400)) {
+ data->unibi_ext.enable_extended_keys = (int)unibi_add_ext_str(ut, "ext.enable_extended_keys",
+ "\x1b[>4;2m");
+ data->unibi_ext.disable_extended_keys = (int)unibi_add_ext_str(ut, "ext.disable_extended_keys",
+ "\x1b[>4m");
+ }
}
}