From 7966020f70255e04bc7a8015a170307c4d5341a8 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Mon, 26 Jun 2023 07:17:45 +0800 Subject: vim-patch:8.2.3833: error from term_start() not caught by try/catch Problem: Error from term_start() not caught by try/catch. Solution: save and restore did_emsg when applying autocommands. (Ozaki Kiichi, closes vim/vim#9361) https://github.com/vim/vim/commit/c3f91c0648f4b04a6a9ceb4ccec45ea767a63796 Co-authored-by: ichizok --- src/nvim/autocmd.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/nvim/autocmd.c b/src/nvim/autocmd.c index 427bce0e80..f3eb5d410d 100644 --- a/src/nvim/autocmd.c +++ b/src/nvim/autocmd.c @@ -1783,8 +1783,12 @@ bool apply_autocmds_group(event_T event, char *fname, char *fname_io, bool force check_lnums_nested(true); } + const int save_did_emsg = did_emsg; + // Execute the autocmd. The `getnextac` callback handles iteration. - do_cmdline(NULL, getnextac, (void *)&patcmd, DOCMD_NOWAIT | DOCMD_VERBOSE | DOCMD_REPEAT); + do_cmdline(NULL, getnextac, &patcmd, DOCMD_NOWAIT | DOCMD_VERBOSE | DOCMD_REPEAT); + + did_emsg += save_did_emsg; if (nesting == 1) { // restore cursor and topline, unless they were changed -- cgit From dc3ee122dc132b5baf11ea0083604927eb6c7443 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Mon, 26 Jun 2023 07:14:43 +0800 Subject: vim-patch:9.0.1665: empty CmdlineEnter autocommand causes errors in Ex mode Problem: Empty CmdlineEnter autocommand causes errors in Ex mode. Solution: Save and restore ex_pressedreturn. (Christian Brabandt, closes # 12581, closes vim/vim#12578) https://github.com/vim/vim/commit/590aae35575cbd74d80c41d87fc647f2812aad70 Co-authored-by: Christian Brabandt --- src/nvim/autocmd.c | 2 ++ test/old/testdir/test_ex_mode.vim | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/src/nvim/autocmd.c b/src/nvim/autocmd.c index f3eb5d410d..36f0183fd8 100644 --- a/src/nvim/autocmd.c +++ b/src/nvim/autocmd.c @@ -1784,11 +1784,13 @@ bool apply_autocmds_group(event_T event, char *fname, char *fname_io, bool force } const int save_did_emsg = did_emsg; + const bool save_ex_pressedreturn = get_pressedreturn(); // Execute the autocmd. The `getnextac` callback handles iteration. do_cmdline(NULL, getnextac, &patcmd, DOCMD_NOWAIT | DOCMD_VERBOSE | DOCMD_REPEAT); did_emsg += save_did_emsg; + set_pressedreturn(save_ex_pressedreturn); if (nesting == 1) { // restore cursor and topline, unless they were changed diff --git a/test/old/testdir/test_ex_mode.vim b/test/old/testdir/test_ex_mode.vim index 3332bc6ab9..42f08868a0 100644 --- a/test/old/testdir/test_ex_mode.vim +++ b/test/old/testdir/test_ex_mode.vim @@ -244,6 +244,12 @@ func Test_ex_mode_errors() au! CmdLineEnter delfunc ExEnterFunc + + au CmdlineEnter * : + call feedkeys("gQecho 1\r", 'xt') + + au! CmdlineEnter + quit endfunc -- cgit