aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2021-01-29 18:02:43 -0500
committerGitHub <noreply@github.com>2021-01-29 18:02:43 -0500
commitad98b84008586a1863e8b05b3db6d2c6c7ad4db8 (patch)
tree836ddf9beab731ee4bf72cb914f115ebbe5ef139
parent8950f4e94af1534852cab5f41066d7c21330bd64 (diff)
parent1376994f1556b51d6a4feaedc094ee2456db5d06 (diff)
downloadrneovim-ad98b84008586a1863e8b05b3db6d2c6c7ad4db8.tar.gz
rneovim-ad98b84008586a1863e8b05b3db6d2c6c7ad4db8.tar.bz2
rneovim-ad98b84008586a1863e8b05b3db6d2c6c7ad4db8.zip
Merge pull request #13833 from janlazo/vim-8.2.2412
vim-patch:8.2.{2412,2418,2420,2425}
-rw-r--r--src/nvim/autocmd.c14
-rw-r--r--src/nvim/edit.c5
-rw-r--r--src/nvim/ex_cmds.c3
-rw-r--r--src/nvim/ex_docmd.c9
-rw-r--r--src/nvim/globals.h2
-rw-r--r--src/nvim/testdir/test_autocmd.vim23
-rw-r--r--src/nvim/testdir/test_eval_stuff.vim11
-rw-r--r--src/nvim/testdir/test_quickfix.vim12
-rw-r--r--src/nvim/testdir/test_window_cmd.vim4
9 files changed, 44 insertions, 39 deletions
diff --git a/src/nvim/autocmd.c b/src/nvim/autocmd.c
index 42224d0a4f..140a9c6bcb 100644
--- a/src/nvim/autocmd.c
+++ b/src/nvim/autocmd.c
@@ -700,11 +700,15 @@ void do_autocmd(char_u *arg_in, int forceit)
last_event = (event_T)-1; // for listing the event name
last_group = AUGROUP_ERROR; // for listing the group name
if (*arg == '*' || *arg == NUL || *arg == '|') {
- for (event_T event = (event_T)0; event < (int)NUM_EVENTS;
- event = (event_T)(event + 1)) {
- if (do_autocmd_event(event, pat, once, nested, cmd, forceit, group)
- == FAIL) {
- break;
+ if (!forceit && *cmd != NUL) {
+ EMSG(_(e_cannot_define_autocommands_for_all_events));
+ } else {
+ for (event_T event = (event_T)0; event < (int)NUM_EVENTS;
+ event = (event_T)(event + 1)) {
+ if (do_autocmd_event(event, pat, once, nested, cmd, forceit, group)
+ == FAIL) {
+ break;
+ }
}
}
} else {
diff --git a/src/nvim/edit.c b/src/nvim/edit.c
index b2abb06075..100e88e261 100644
--- a/src/nvim/edit.c
+++ b/src/nvim/edit.c
@@ -313,6 +313,11 @@ static void insert_enter(InsertState *s)
set_vim_var_string(VV_CHAR, NULL, -1);
ins_apply_autocmds(EVENT_INSERTENTER);
+ // Check for changed highlighting, e.g. for ModeMsg.
+ if (need_highlight_changed) {
+ highlight_changed();
+ }
+
// Make sure the cursor didn't move. Do call check_cursor_col() in
// case the text was modified. Since Insert mode was not started yet
// a call to check_cursor_col() may move the cursor, especially with
diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c
index a2487336f1..2da8c205c1 100644
--- a/src/nvim/ex_cmds.c
+++ b/src/nvim/ex_cmds.c
@@ -3126,6 +3126,9 @@ static bool sub_joining_lines(exarg_T *eap, char_u *pat, char_u *sub,
|| *cmd == 'l'
|| *cmd == 'p'
|| *cmd == '#')))) {
+ if (eap->skip) {
+ return true;
+ }
curwin->w_cursor.lnum = eap->line1;
if (*cmd == 'l') {
eap->flags = EXFLAG_LIST;
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c
index 18683c54d3..8b00417ce3 100644
--- a/src/nvim/ex_docmd.c
+++ b/src/nvim/ex_docmd.c
@@ -317,7 +317,9 @@ int do_cmdline(char_u *cmdline, LineGetter fgetline,
int count = 0; /* line number count */
int did_inc = FALSE; /* incremented RedrawingDisabled */
int retval = OK;
- cstack_T cstack; // conditional stack
+ cstack_T cstack = { // conditional stack
+ .cs_idx = -1,
+ };
garray_T lines_ga; // keep lines for ":while"/":for"
int current_line = 0; // active line in lines_ga
char_u *fname = NULL; // function or script name
@@ -360,11 +362,6 @@ int do_cmdline(char_u *cmdline, LineGetter fgetline,
call_depth++;
start_batch_changes();
- cstack.cs_idx = -1;
- cstack.cs_looplevel = 0;
- cstack.cs_trylevel = 0;
- cstack.cs_emsg_silent_list = NULL;
- cstack.cs_lflags = 0;
ga_init(&lines_ga, (int)sizeof(wcmd_T), 10);
real_cookie = getline_cookie(fgetline, cookie);
diff --git a/src/nvim/globals.h b/src/nvim/globals.h
index 3b8f4116b7..22f06941aa 100644
--- a/src/nvim/globals.h
+++ b/src/nvim/globals.h
@@ -1009,6 +1009,8 @@ EXTERN char_u e_floatonly[] INIT(=N_(
EXTERN char_u e_floatexchange[] INIT(=N_(
"E5602: Cannot exchange or rotate float"));
+EXTERN char e_cannot_define_autocommands_for_all_events[] INIT(= N_(
+ "E1155: Cannot define autocommands for ALL events"));
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/testdir/test_autocmd.vim b/src/nvim/testdir/test_autocmd.vim
index c571e37ac3..374ad65aa9 100644
--- a/src/nvim/testdir/test_autocmd.vim
+++ b/src/nvim/testdir/test_autocmd.vim
@@ -1279,26 +1279,9 @@ func Test_TextYankPost()
bwipe!
endfunc
-func Test_nocatch_wipe_all_buffers()
- " Real nasty autocommand: wipe all buffers on any event.
- au * * bwipe *
- call assert_fails('next x', 'E93')
- bwipe
- au!
-endfunc
-
-func Test_nocatch_wipe_dummy_buffer()
- " Nasty autocommand: wipe buffer on any event.
- au * x bwipe
- call assert_fails('lv½ /x', 'E480')
- au!
-endfunc
-
-func Test_wipe_cbuffer()
- sv x
- au * * bw
- lb
- au!
+func Test_autocommand_all_events()
+ call assert_fails('au * * bwipe', 'E1155:')
+ call assert_fails('au * x bwipe', 'E1155:')
endfunc
" Test TextChangedI and TextChangedP
diff --git a/src/nvim/testdir/test_eval_stuff.vim b/src/nvim/testdir/test_eval_stuff.vim
index 061364fb73..ff50d53d86 100644
--- a/src/nvim/testdir/test_eval_stuff.vim
+++ b/src/nvim/testdir/test_eval_stuff.vim
@@ -22,6 +22,17 @@ func Test_E963()
call assert_equal(v_o, v:oldfiles)
endfunc
+func Test_for_invalid()
+ call assert_fails("for x in 99", 'E714:')
+ call assert_fails("for x in 'asdf'", 'E714:')
+ call assert_fails("for x in {'a': 9}", 'E714:')
+
+ if 0
+ /1/5/2/s/\n
+ endif
+ redraw
+endfunc
+
func Test_mkdir_p()
call mkdir('Xmkdir/nested', 'p')
call assert_true(isdirectory('Xmkdir/nested'))
diff --git a/src/nvim/testdir/test_quickfix.vim b/src/nvim/testdir/test_quickfix.vim
index 48c0a83053..00a253a215 100644
--- a/src/nvim/testdir/test_quickfix.vim
+++ b/src/nvim/testdir/test_quickfix.vim
@@ -3540,7 +3540,7 @@ func Test_lbuffer_crash()
sv Xtest
augroup QF_Test
au!
- au * * bw
+ au QuickFixCmdPre,QuickFixCmdPost,BufEnter,BufLeave * bw
augroup END
lbuffer
augroup QF_Test
@@ -3552,7 +3552,7 @@ endfunc
func Test_lexpr_crash()
augroup QF_Test
au!
- au * * call setloclist(0, [], 'f')
+ au QuickFixCmdPre,QuickFixCmdPost,BufEnter,BufLeave * call setloclist(0, [], 'f')
augroup END
lexpr ""
augroup QF_Test
@@ -3587,7 +3587,7 @@ func Test_lvimgrep_crash()
sv Xtest
augroup QF_Test
au!
- au * * call setloclist(0, [], 'f')
+ au QuickFixCmdPre,QuickFixCmdPost,BufEnter,BufLeave * call setloclist(0, [], 'f')
augroup END
lvimgrep quickfix test_quickfix.vim
augroup QF_Test
@@ -3889,7 +3889,7 @@ func Test_lbuffer_with_bwipe()
new
new
augroup nasty
- au * * bwipe
+ au QuickFixCmdPre,QuickFixCmdPost,BufEnter,BufLeave * bwipe
augroup END
lbuffer
augroup nasty
@@ -3902,9 +3902,9 @@ endfunc
func Xexpr_acmd_freelist(cchar)
call s:setup_commands(a:cchar)
- " This was using freed memory.
+ " This was using freed memory (but with what events?)
augroup nasty
- au * * call g:Xsetlist([], 'f')
+ au QuickFixCmdPre,QuickFixCmdPost,BufEnter,BufLeave * call g:Xsetlist([], 'f')
augroup END
Xexpr "x"
augroup nasty
diff --git a/src/nvim/testdir/test_window_cmd.vim b/src/nvim/testdir/test_window_cmd.vim
index 687b1cb989..969b75d424 100644
--- a/src/nvim/testdir/test_window_cmd.vim
+++ b/src/nvim/testdir/test_window_cmd.vim
@@ -513,8 +513,8 @@ func Test_window_colon_command()
endfunc
func Test_access_freed_mem()
- " This was accessing freed memory
- au * 0 vs xxx
+ " This was accessing freed memory (but with what events?)
+ au BufEnter,BufLeave,WinEnter,WinLeave 0 vs xxx
arg 0
argadd
all