aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2018-02-11 19:59:37 +0100
committerGitHub <noreply@github.com>2018-02-11 19:59:37 +0100
commitf389196a344591da2f6cc2a63f4953e34316f954 (patch)
tree8cce092c29f33ae109dcf61e12e822d84aa014c7
parent2cfc1b055bba6bb0f7e263a69079c7f52303a78a (diff)
parentf26a4d484b486019c90fc55af5e74e33de374bc4 (diff)
downloadrneovim-f389196a344591da2f6cc2a63f4953e34316f954.tar.gz
rneovim-f389196a344591da2f6cc2a63f4953e34316f954.tar.bz2
rneovim-f389196a344591da2f6cc2a63f4953e34316f954.zip
Merge #7960 'vim patches'
-rw-r--r--runtime/doc/editing.txt12
-rw-r--r--runtime/doc/vim_diff.txt2
-rw-r--r--runtime/filetype.vim40
-rwxr-xr-xscripts/vim-patch.sh3
-rw-r--r--src/nvim/buffer.c15
-rw-r--r--src/nvim/diff.c22
-rw-r--r--src/nvim/ex_cmds.lua2
-rw-r--r--src/nvim/ex_cmds2.c53
-rw-r--r--src/nvim/ex_docmd.c24
-rw-r--r--src/nvim/ex_getln.c33
-rw-r--r--src/nvim/fileio.c41
-rw-r--r--src/nvim/memline.c19
-rw-r--r--src/nvim/misc1.c7
-rw-r--r--src/nvim/normal.c35
-rw-r--r--src/nvim/ops.c13
-rw-r--r--src/nvim/option.c108
-rw-r--r--src/nvim/popupmnu.c8
-rw-r--r--src/nvim/quickfix.c13
-rw-r--r--src/nvim/search.c13
-rw-r--r--src/nvim/testdir/Makefile14
-rw-r--r--src/nvim/testdir/runtest.vim93
-rw-r--r--src/nvim/testdir/test32.in60
-rw-r--r--src/nvim/testdir/test32.ok15
-rw-r--r--src/nvim/testdir/test53.in74
-rw-r--r--src/nvim/testdir/test53.ok45
-rw-r--r--src/nvim/testdir/test79.inbin3335 -> 0 bytes
-rw-r--r--src/nvim/testdir/test79.okbin570 -> 0 bytes
-rw-r--r--src/nvim/testdir/test_alot.vim3
-rw-r--r--src/nvim/testdir/test_arglist.vim355
-rw-r--r--src/nvim/testdir/test_autochdir.vim19
-rw-r--r--src/nvim/testdir/test_autocmd.vim747
-rw-r--r--src/nvim/testdir/test_bufwintabinfo.vim1
-rw-r--r--src/nvim/testdir/test_cmdline.vim1
-rw-r--r--src/nvim/testdir/test_command_count.vim20
-rw-r--r--src/nvim/testdir/test_curswant.vim23
-rw-r--r--src/nvim/testdir/test_diffmode.vim1
-rw-r--r--src/nvim/testdir/test_digraph.vim1
-rw-r--r--src/nvim/testdir/test_edit.vim1310
-rw-r--r--src/nvim/testdir/test_exists.vim321
-rw-r--r--src/nvim/testdir/test_file_size.vim58
-rw-r--r--src/nvim/testdir/test_filetype.vim557
-rw-r--r--src/nvim/testdir/test_hardcopy.vim1
-rw-r--r--src/nvim/testdir/test_ins_complete.vim92
-rw-r--r--src/nvim/testdir/test_let.vim27
-rw-r--r--src/nvim/testdir/test_lineending.vim19
-rw-r--r--src/nvim/testdir/test_lispwords.vim82
-rw-r--r--src/nvim/testdir/test_normal.vim1
-rw-r--r--src/nvim/testdir/test_popup.vim37
-rw-r--r--src/nvim/testdir/test_quickfix.vim2
-rw-r--r--src/nvim/testdir/test_recover.vim63
-rw-r--r--src/nvim/testdir/test_scrollbind.vim32
-rw-r--r--src/nvim/testdir/test_search.vim146
-rw-r--r--src/nvim/testdir/test_signs.vim2
-rw-r--r--src/nvim/testdir/test_source_utf8.vim30
-rw-r--r--src/nvim/testdir/test_substitute.vim207
-rw-r--r--src/nvim/testdir/test_tab.vim45
-rw-r--r--src/nvim/testdir/test_tabpage.vim19
-rw-r--r--src/nvim/testdir/test_tagjump.vim37
-rw-r--r--src/nvim/testdir/test_textobjects.vim128
-rw-r--r--src/nvim/testdir/test_undo.vim24
-rw-r--r--src/nvim/testdir/test_usercommands.vim1
-rw-r--r--src/nvim/testdir/test_visual.vim102
-rw-r--r--src/nvim/testdir/test_winbuf_close.vim124
-rw-r--r--src/nvim/vim.h4
-rw-r--r--test/functional/legacy/arglist_spec.lua11
-rw-r--r--test/functional/legacy/edit_spec.lua25
-rw-r--r--test/functional/legacy/search_spec.lua110
67 files changed, 5118 insertions, 434 deletions
diff --git a/runtime/doc/editing.txt b/runtime/doc/editing.txt
index 1b9a1b38fb..5939cb8a8b 100644
--- a/runtime/doc/editing.txt
+++ b/runtime/doc/editing.txt
@@ -562,16 +562,16 @@ list of the current window.
buffer.
Also see |++opt| and |+cmd|.
-:[count]arge[dit][!] [++opt] [+cmd] {name} *:arge* *:argedit*
- Add {name} to the argument list and edit it.
+:[count]arge[dit][!] [++opt] [+cmd] {name} .. *:arge* *:argedit*
+ Add {name}s to the argument list and edit it.
When {name} already exists in the argument list, this
entry is edited.
This is like using |:argadd| and then |:edit|.
- Note that only one file name is allowed, and spaces
- inside the file name are allowed, like with |:edit|.
+ Spaces in filenames have to be escaped with "\".
[count] is used like with |:argadd|.
- [!] is required if the current file cannot be
- |abandon|ed.
+ If the current file cannot be |abandon|ed {name}s will
+ still be added to the argument list, but won't be
+ edited. No check for duplicates is done.
Also see |++opt| and |+cmd|.
:[count]arga[dd] {name} .. *:arga* *:argadd* *E479*
diff --git a/runtime/doc/vim_diff.txt b/runtime/doc/vim_diff.txt
index d61c4d0c06..7426cd0940 100644
--- a/runtime/doc/vim_diff.txt
+++ b/runtime/doc/vim_diff.txt
@@ -376,7 +376,6 @@ MS-DOS support:
Test functions:
test_alloc_fail()
test_autochdir()
- test_disable_char_avail()
test_garbagecollect_now()
test_null_channel()
test_null_dict()
@@ -384,6 +383,7 @@ Test functions:
test_null_list()
test_null_partial()
test_null_string()
+ test_override()
test_settime()
Other options:
diff --git a/runtime/filetype.vim b/runtime/filetype.vim
index 76f76af345..a2e1f23bf1 100644
--- a/runtime/filetype.vim
+++ b/runtime/filetype.vim
@@ -1019,7 +1019,7 @@ au BufNewFile,BufRead *.java,*.jav setf java
au BufNewFile,BufRead *.jj,*.jjt setf javacc
" JavaScript, ECMAScript
-au BufNewFile,BufRead *.js,*.javascript,*.es,*.jsx setf javascript
+au BufNewFile,BufRead *.js,*.javascript,*.es,*.jsx,*.mjs setf javascript
" Java Server Pages
au BufNewFile,BufRead *.jsp setf jsp
@@ -1183,14 +1183,21 @@ au BufNewFile,BufRead *.markdown,*.mdown,*.mkd,*.mkdn,*.mdwn,*.md setf markdown
" Mason
au BufNewFile,BufRead *.mason,*.mhtml,*.comp setf mason
-" Matlab or Objective C
+" Mathematica, Matlab, Murphi or Objective C
au BufNewFile,BufRead *.m call s:FTm()
func! s:FTm()
let n = 1
- while n < 10
+ let saw_comment = 0 " Whether we've seen a multiline comment leader.
+ while n < 100
let line = getline(n)
- if line =~ '^\s*\(#\s*\(include\|import\)\>\|@import\>\|/\*\|//\)'
+ if line =~ '^\s*/\*'
+ " /* ... */ is a comment in Objective C and Murphi, so we can't conclude
+ " it's either of them yet, but track this as a hint in case we don't see
+ " anything more definitive.
+ let saw_comment = 1
+ endif
+ if line =~ '^\s*\(#\s*\(include\|import\)\>\|@import\>\|//\)'
setf objc
return
endif
@@ -1202,11 +1209,23 @@ func! s:FTm()
setf mma
return
endif
+ if line =~ '^\c\s*\(\(type\|var\)\>\|--\)'
+ setf murphi
+ return
+ endif
let n = n + 1
endwhile
- if exists("g:filetype_m")
+
+ if saw_comment
+ " We didn't see anything definitive, but this looks like either Objective C
+ " or Murphi based on the comment leader. Assume the former as it is more
+ " common.
+ setf objc
+ elseif exists("g:filetype_m")
+ " Use user specified default filetype for .m
exe "setf " . g:filetype_m
else
+ " Default is matlab
setf matlab
endif
endfunc
@@ -1315,6 +1334,9 @@ au BufNewFile,BufRead *.mush setf mush
" Mutt setup file (also for Muttng)
au BufNewFile,BufRead Mutt{ng,}rc setf muttrc
+" N1QL
+au BufRead,BufNewfile *.n1ql,*.nql setf n1ql
+
" Nano
au BufNewFile,BufRead */etc/nanorc,*.nanorc setf nanorc
@@ -2246,6 +2268,8 @@ func! s:FTtex()
elseif format == 'plaintex'
let format = 'plain'
endif
+ elseif expand('%') =~ 'tex/context/.*/.*.tex'
+ let format = 'context'
else
" Default value, may be changed later:
let format = exists("g:tex_flavor") ? g:tex_flavor : 'plain'
@@ -2287,7 +2311,7 @@ func! s:FTtex()
endfunc
" ConTeXt
-au BufNewFile,BufRead tex/context/*/*.tex,*.mkii,*.mkiv,*.mkvi setf context
+au BufNewFile,BufRead *.mkii,*.mkiv,*.mkvi setf context
" Texinfo
au BufNewFile,BufRead *.texinfo,*.texi,*.txi setf texinfo
@@ -2792,12 +2816,12 @@ runtime! ftdetect/*.vim
" state.
augroup END
-" Generic configuration file (check this last, it's just guessing!)
+" Generic configuration file. Use FALLBACK, it's just guessing!
au filetypedetect BufNewFile,BufRead,StdinReadPost *
\ if !did_filetype() && expand("<amatch>") !~ g:ft_ignore_pat
\ && (getline(1) =~ '^#' || getline(2) =~ '^#' || getline(3) =~ '^#'
\ || getline(4) =~ '^#' || getline(5) =~ '^#') |
- \ setf conf |
+ \ setf FALLBACK conf |
\ endif
diff --git a/scripts/vim-patch.sh b/scripts/vim-patch.sh
index ac5e326e9d..c7a23abe5e 100755
--- a/scripts/vim-patch.sh
+++ b/scripts/vim-patch.sh
@@ -234,7 +234,8 @@ stage_patch() {
printf "\n✘ 'patch' command not found\n"
else
printf "\nApplying patch...\n"
- patch -p1 --posix < "${patch_file}" || true
+ patch -p1 < "${patch_file}" || true
+ find -name '*.orig' -type f -delete
fi
printf "\nInstructions:\n Proceed to port the patch.\n"
else
diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c
index a86a908492..8d0738dd29 100644
--- a/src/nvim/buffer.c
+++ b/src/nvim/buffer.c
@@ -1387,20 +1387,25 @@ void set_curbuf(buf_T *buf, int action)
/* Don't restart Select mode after switching to another buffer. */
VIsual_reselect = FALSE;
- /* close_windows() or apply_autocmds() may change curbuf */
+ // close_windows() or apply_autocmds() may change curbuf and wipe out "buf"
prevbuf = curbuf;
- bufref_T bufref;
- set_bufref(&bufref, prevbuf);
+ bufref_T newbufref;
+ bufref_T prevbufref;
+ set_bufref(&prevbufref, prevbuf);
+ set_bufref(&newbufref, buf);
+ // Autocommands may delete the curren buffer and/or the buffer we wan to go
+ // to. In those cases don't close the buffer.
if (!apply_autocmds(EVENT_BUFLEAVE, NULL, NULL, false, curbuf)
- || (bufref_valid(&bufref) && !aborting())) {
+ || (bufref_valid(&prevbufref) && bufref_valid(&newbufref)
+ && !aborting())) {
if (prevbuf == curwin->w_buffer) {
reset_synblock(curwin);
}
if (unload) {
close_windows(prevbuf, false);
}
- if (bufref_valid(&bufref) && !aborting()) {
+ if (bufref_valid(&prevbufref) && !aborting()) {
win_T *previouswin = curwin;
if (prevbuf == curbuf)
u_sync(FALSE);
diff --git a/src/nvim/diff.c b/src/nvim/diff.c
index e55cf7bf7e..0ee1c3815d 100644
--- a/src/nvim/diff.c
+++ b/src/nvim/diff.c
@@ -1058,6 +1058,20 @@ void ex_diffthis(exarg_T *eap)
diff_win_options(curwin, TRUE);
}
+static void set_diff_option(win_T *wp, int value)
+{
+ win_T *old_curwin = curwin;
+
+ curwin = wp;
+ curbuf = curwin->w_buffer;
+ curbuf_lock++;
+ set_option_value("diff", (long)value, NULL, OPT_LOCAL);
+ curbuf_lock--;
+ curwin = old_curwin;
+ curbuf = curwin->w_buffer;
+}
+
+
/// Set options in window "wp" for diff mode.
///
/// @param addbuf Add buffer to diff.
@@ -1115,10 +1129,10 @@ void diff_win_options(win_T *wp, int addbuf)
do_cmdline_cmd("set sbo+=hor");
}
- // Saved the current values, to be restored in ex_diffoff().
- wp->w_p_diff_saved = TRUE;
+ // Save the current values, to be restored in ex_diffoff().
+ wp->w_p_diff_saved = true;
- wp->w_p_diff = true;
+ set_diff_option(wp, true);
if (addbuf) {
diff_buf_add(wp->w_buffer);
@@ -1139,7 +1153,7 @@ void ex_diffoff(exarg_T *eap)
// Set 'diff' off. If option values were saved in
// diff_win_options(), restore the ones whose settings seem to have
// been left over from diff mode.
- wp->w_p_diff = false;
+ set_diff_option(wp, false);
if (wp->w_p_diff_saved) {
if (wp->w_p_scb) {
diff --git a/src/nvim/ex_cmds.lua b/src/nvim/ex_cmds.lua
index c8593f7460..ce02808ad3 100644
--- a/src/nvim/ex_cmds.lua
+++ b/src/nvim/ex_cmds.lua
@@ -108,7 +108,7 @@ return {
},
{
command='argedit',
- flags=bit.bor(BANG, NEEDARG, RANGE, NOTADR, ZEROR, FILE1, EDITCMD, ARGOPT, TRLBAR),
+ flags=bit.bor(BANG, NEEDARG, RANGE, NOTADR, ZEROR, FILES, EDITCMD, ARGOPT, TRLBAR),
addr_type=ADDR_ARGUMENTS,
func='ex_argedit',
},
diff --git a/src/nvim/ex_cmds2.c b/src/nvim/ex_cmds2.c
index 28b021d4e4..5975ca43e6 100644
--- a/src/nvim/ex_cmds2.c
+++ b/src/nvim/ex_cmds2.c
@@ -1558,12 +1558,17 @@ static char_u *do_one_arg(char_u *str)
/// Separate the arguments in "str" and return a list of pointers in the
/// growarray "gap".
-void get_arglist(garray_T *gap, char_u *str)
+static void get_arglist(garray_T *gap, char_u *str, int escaped)
{
ga_init(gap, (int)sizeof(char_u *), 20);
while (*str != NUL) {
GA_APPEND(char_u *, gap, str);
+ // If str is escaped, don't handle backslashes or spaces
+ if (!escaped) {
+ return;
+ }
+
// Isolate one argument, change it in-place, put a NUL after it.
str = do_one_arg(str);
}
@@ -1578,7 +1583,7 @@ int get_arglist_exp(char_u *str, int *fcountp, char_u ***fnamesp, bool wig)
garray_T ga;
int i;
- get_arglist(&ga, str);
+ get_arglist(&ga, str, true);
if (wig) {
i = expand_wildcards(ga.ga_len, (char_u **)ga.ga_data,
@@ -1609,6 +1614,7 @@ static int do_arglist(char_u *str, int what, int after)
char_u **exp_files;
char_u *p;
int match;
+ int arg_escaped = true;
// Set default argument for ":argadd" command.
if (what == AL_ADD && *str == NUL) {
@@ -1616,10 +1622,11 @@ static int do_arglist(char_u *str, int what, int after)
return FAIL;
}
str = curbuf->b_fname;
+ arg_escaped = false;
}
// Collect all file name arguments in "new_ga".
- get_arglist(&new_ga, str);
+ get_arglist(&new_ga, str, arg_escaped);
if (what == AL_DEL) {
regmatch_T regmatch;
@@ -1915,31 +1922,21 @@ void ex_next(exarg_T *eap)
/// ":argedit"
void ex_argedit(exarg_T *eap)
{
- int fnum;
- int i;
- char_u *s;
-
- // Add the argument to the buffer list and get the buffer number.
- fnum = buflist_add(eap->arg, BLN_LISTED);
+ int i = eap->addr_count ? (int)eap->line2 : curwin->w_arg_idx + 1;
- // Check if this argument is already in the argument list.
- for (i = 0; i < ARGCOUNT; i++) {
- if (ARGLIST[i].ae_fnum == fnum) {
- break;
- }
- }
- if (i == ARGCOUNT) {
- // Can't find it, add it to the argument list.
- s = vim_strsave(eap->arg);
- int after = eap->addr_count > 0 ? (int)eap->line2 : curwin->w_arg_idx + 1;
- i = alist_add_list(1, &s, after);
- curwin->w_arg_idx = i;
+ if (do_arglist(eap->arg, AL_ADD, i) == FAIL) {
+ return;
}
+ maketitle();
- alist_check_arg_idx();
-
+ if (curwin->w_arg_idx == 0 && (curbuf->b_ml.ml_flags & ML_EMPTY)
+ && curbuf->b_ffname == NULL) {
+ i = 0;
+ }
// Edit the argument.
- do_argfile(eap, i);
+ if (i < ARGCOUNT) {
+ do_argfile(eap, i);
+ }
}
/// ":argadd"
@@ -1959,8 +1956,14 @@ void ex_argdelete(exarg_T *eap)
eap->line2 = ARGCOUNT;
}
linenr_T n = eap->line2 - eap->line1 + 1;
- if (*eap->arg != NUL || n <= 0) {
+ if (*eap->arg != NUL) {
+ // Can't have both a range and an argument.
EMSG(_(e_invarg));
+ } else if (n <= 0) {
+ // Don't give an error for ":%argdel" if the list is empty.
+ if (eap->line1 != 1 || eap->line2 != 0) {
+ EMSG(_(e_invrange));
+ }
} else {
for (linenr_T i = eap->line1; i <= eap->line2; i++) {
xfree(ARGLIST[i - 1].ae_fname);
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c
index 4f0208c5c3..aebc395f56 100644
--- a/src/nvim/ex_docmd.c
+++ b/src/nvim/ex_docmd.c
@@ -5974,15 +5974,18 @@ static void ex_quit(exarg_T *eap)
wp = curwin;
}
- apply_autocmds(EVENT_QUITPRE, NULL, NULL, false, curbuf);
+ // Refuse to quit when locked.
+ if (curbuf_locked()) {
+ return;
+ }
+ apply_autocmds(EVENT_QUITPRE, NULL, NULL, false, wp->w_buffer);
// Refuse to quit when locked or when the buffer in the last window is
// being closed (can only happen in autocommands).
- if (curbuf_locked()
+ if (!win_valid(wp)
|| (wp->w_buffer->b_nwindows == 1 && wp->w_buffer->b_locked > 0)) {
return;
}
-
/*
* If there are more files or windows we won't exit.
*/
@@ -9740,13 +9743,20 @@ void filetype_maybe_enable(void)
}
}
-/*
- * ":setfiletype {name}"
- */
+/// ":setfiletype [FALLBACK] {name}"
static void ex_setfiletype(exarg_T *eap)
{
if (!did_filetype) {
- set_option_value("filetype", 0L, (char *)eap->arg, OPT_LOCAL);
+ char_u *arg = eap->arg;
+
+ if (STRNCMP(arg, "FALLBACK ", 9) == 0) {
+ arg += 9;
+ }
+
+ set_option_value("filetype", 0L, (char *)arg, OPT_LOCAL);
+ if (arg != eap->arg) {
+ did_filetype = false;
+ }
}
}
diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c
index 40b4cc6d79..07aab3307a 100644
--- a/src/nvim/ex_getln.c
+++ b/src/nvim/ex_getln.c
@@ -443,14 +443,8 @@ static uint8_t *command_line_enter(int firstc, long count, int indent)
}
}
- if (s->gotesc) { // abandon command line
- xfree(ccline.cmdbuff);
- ccline.cmdbuff = NULL;
- if (msg_scrolled == 0) {
- compute_cmdrow();
- }
- MSG("");
- redraw_cmdline = true;
+ if (s->gotesc) {
+ abandon_cmdline();
}
}
@@ -1062,6 +1056,12 @@ static void command_line_next_incsearch(CommandLineState *s, bool next_match)
// put back on the match
s->search_start = t;
(void)decl(&s->search_start);
+ } else if (next_match && s->firstc == '?') {
+ // move just after the current match, so that
+ // when nv_search finishes the cursor will be
+ // put back on the match
+ s->search_start = t;
+ (void)incl(&s->search_start);
}
if (lt(t, s->search_start) && next_match) {
// wrap around
@@ -1549,7 +1549,7 @@ static int command_line_handle_key(CommandLineState *s)
}
if (s->c != NUL) {
if (s->c == s->firstc
- || vim_strchr((char_u *)(p_magic ? "\\^$.*[" : "\\^$"), s->c)
+ || vim_strchr((char_u *)(p_magic ? "\\~^$.*[" : "\\^$"), s->c)
!= NULL) {
// put a backslash before special characters
stuffcharReadbuff(s->c);
@@ -1673,9 +1673,6 @@ static int command_line_handle_key(CommandLineState *s)
case Ctrl_G: // next match
case Ctrl_T: // previous match
if (p_is && !cmd_silent && (s->firstc == '/' || s->firstc == '?')) {
- if (char_avail()) {
- return 1;
- }
if (ccline.cmdlen != 0) {
command_line_next_incsearch(s, s->c == Ctrl_G);
}
@@ -1941,6 +1938,18 @@ static int command_line_changed(CommandLineState *s)
return 1;
}
+/// Abandon the command line.
+static void abandon_cmdline(void)
+{
+ xfree(ccline.cmdbuff);
+ ccline.cmdbuff = NULL;
+ if (msg_scrolled == 0) {
+ compute_cmdrow();
+ }
+ MSG("");
+ redraw_cmdline = true;
+}
+
/*
* getcmdline() - accept a command line starting with firstc.
*
diff --git a/src/nvim/fileio.c b/src/nvim/fileio.c
index 44d74c92cd..91b0a695f1 100644
--- a/src/nvim/fileio.c
+++ b/src/nvim/fileio.c
@@ -6274,13 +6274,13 @@ do_doautocmd (
fname = skipwhite(fname);
- /*
- * Loop over the events.
- */
- while (*arg && !ascii_iswhite(*arg))
- if (apply_autocmds_group(event_name2nr(arg, &arg),
- fname, NULL, TRUE, group, curbuf, NULL))
- nothing_done = FALSE;
+ // Loop over the events.
+ while (*arg && !ends_excmd(*arg) && !ascii_iswhite(*arg)) {
+ if (apply_autocmds_group(event_name2nr(arg, &arg), fname, NULL, true,
+ group, curbuf, NULL)) {
+ nothing_done = false;
+ }
+ }
if (nothing_done && do_msg) {
MSG(_("No matching autocommands"));
@@ -6671,12 +6671,12 @@ static bool apply_autocmds_group(event_T event, char_u *fname, char_u *fname_io,
proftime_T wait_time;
bool did_save_redobuff = false;
- /*
- * Quickly return if there are no autocommands for this event or
- * autocommands are blocked.
- */
- if (first_autopat[(int)event] == NULL || autocmd_blocked > 0)
+ // Quickly return if there are no autocommands for this event or
+ // autocommands are blocked.
+ if (event == NUM_EVENTS || first_autopat[(int)event] == NULL
+ || autocmd_block