From f4cbe96488fce4de971be2e25b254320f0fa71b2 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sun, 20 Oct 2019 05:59:29 -0400 Subject: [PATCH 1/4] vim-patch:8.1.2185: syntax test fails Problem: Syntax test fails. Solution: Add missing file patch. https://github.com/vim/vim/commit/bbfd1562aeaa5b40b6451effc399846b692d6992 --- src/nvim/testdir/test_syntax.vim | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/nvim/testdir/test_syntax.vim b/src/nvim/testdir/test_syntax.vim index b9310e2168..c2025b36e0 100644 --- a/src/nvim/testdir/test_syntax.vim +++ b/src/nvim/testdir/test_syntax.vim @@ -519,6 +519,7 @@ func Test_syntax_c() \ ' for (int i = 0; i < count; ++i) {', \ ' break;', \ ' }', + \ " Note: asdf", \ '}', \ ], 'Xtest.c') @@ -526,7 +527,8 @@ func Test_syntax_c() " response to t_RB corrects it to "light". let $COLORFGBG = '15;0' - let buf = RunVimInTerminal('Xtest.c', {}) + let buf = RunVimInTerminal('Xtest.c', #{rows: 22}) + call term_sendkeys(buf, ":syn keyword Search Note\r") call VerifyScreenDump(buf, 'Test_syntax_c_01', {}) call StopVimInTerminal(buf) From 60415a5d3a0fec6fc42a900aba15943b3d1730cd Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sun, 20 Oct 2019 06:04:07 -0400 Subject: [PATCH 2/4] vim-patch:8.1.2188: build error for missing define Problem: Build error for missing define. Solution: Add missing change. https://github.com/vim/vim/commit/2b78ab5d0c91c229715ae140a34978506343bde3 These "WILD_" macros are used in earlier vim patches. --- src/nvim/ex_getln.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/nvim/ex_getln.h b/src/nvim/ex_getln.h index 051564fbe1..99d5a7786d 100644 --- a/src/nvim/ex_getln.h +++ b/src/nvim/ex_getln.h @@ -27,6 +27,8 @@ #define WILD_ESCAPE 0x80 #define WILD_ICASE 0x100 #define WILD_ALLLINKS 0x200 +#define WILD_IGNORE_COMPLETESLASH 0x400 +#define WILD_NOERROR 0x800 // sets EW_NOERROR /// Present history tables typedef enum { From 13a6878d187612721baecede181e7dfdc3699a59 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sun, 20 Oct 2019 16:39:48 -0400 Subject: [PATCH 3/4] vim-patch:8.1.2190: syntax test fails on Mac Problem: Syntax test fails on Mac. Solution: Limit the window size to 20 rows. https://github.com/vim/vim/commit/83e9a1ce75818a78c5ddf8dcfb820634ca6fabff --- src/nvim/testdir/test_syntax.vim | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/nvim/testdir/test_syntax.vim b/src/nvim/testdir/test_syntax.vim index c2025b36e0..6cada1503f 100644 --- a/src/nvim/testdir/test_syntax.vim +++ b/src/nvim/testdir/test_syntax.vim @@ -502,9 +502,7 @@ func Test_syntax_c() endif call writefile([ \ '/* comment line at the top */', - \ ' int', - \ 'main(int argc, char **argv)// another comment', - \ '{', + \ 'int main(int argc, char **argv) { // another comment', \ '#if 0', \ ' int not_used;', \ '#else', @@ -527,7 +525,7 @@ func Test_syntax_c() " response to t_RB corrects it to "light". let $COLORFGBG = '15;0' - let buf = RunVimInTerminal('Xtest.c', #{rows: 22}) + let buf = RunVimInTerminal('Xtest.c', {}) call term_sendkeys(buf, ":syn keyword Search Note\r") call VerifyScreenDump(buf, 'Test_syntax_c_01', {}) call StopVimInTerminal(buf) From c067efa696698d455d9a1488c26e0fb5d8cb5bf5 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sun, 20 Oct 2019 20:12:08 -0400 Subject: [PATCH 4/4] vim-patch:8.1.2197: ExitPre autocommand may cause accessing freed memory Problem: ExitPre autocommand may cause accessing freed memory. Solution: Check the window pointer is still valid. (closes vim/vim#5093) https://github.com/vim/vim/commit/34ba06b6e6f94bb46062e6c85dbfdcbb0d255ada --- src/nvim/ex_docmd.c | 8 +++++--- src/nvim/testdir/test_exit.vim | 22 ++++++++++++++++++++++ 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c index 0da2cd67d6..ae3fb4fbfb 100644 --- a/src/nvim/ex_docmd.c +++ b/src/nvim/ex_docmd.c @@ -6070,9 +6070,11 @@ static bool before_quit_autocmds(win_T *wp, bool quit_all, int forceit) if (quit_all || (check_more(false, forceit) == OK && only_one_window())) { apply_autocmds(EVENT_EXITPRE, NULL, NULL, false, curbuf); - // Refuse to quit when locked or when the buffer in the last window is - // being closed (can only happen in autocommands). - if (curbuf_locked() + // Refuse to quit when locked or when the window was closed or the + // buffer in the last window is being closed (can only happen in + // autocommands). + if (!win_valid(wp) + || curbuf_locked() || (curbuf->b_nwindows == 1 && curbuf->b_locked > 0)) { return true; } diff --git a/src/nvim/testdir/test_exit.vim b/src/nvim/testdir/test_exit.vim index 3797626abf..99a401d4a4 100644 --- a/src/nvim/testdir/test_exit.vim +++ b/src/nvim/testdir/test_exit.vim @@ -40,6 +40,7 @@ func Test_exiting() endif call delete('Xtestout') + " ExitPre autocommand splits the window, so that it's no longer the last one. let after =<< trim [CODE] au QuitPre * call writefile(["QuitPre"], "Xtestout", "a") au ExitPre * call writefile(["ExitPre"], "Xtestout", "a") @@ -58,4 +59,25 @@ func Test_exiting() \ readfile('Xtestout')) endif call delete('Xtestout') + + " ExitPre autocommand splits and closes the window, so that there is still + " one window but it's a different one. + let after =<< trim [CODE] + au QuitPre * call writefile(["QuitPre"], "Xtestout", "a") + au ExitPre * call writefile(["ExitPre"], "Xtestout", "a") + augroup nasty + au ExitPre * split | only + augroup END + quit + augroup nasty + au! ExitPre + augroup END + quit + [CODE] + + if RunVim([], after, '') + call assert_equal(['QuitPre', 'ExitPre', 'QuitPre', 'ExitPre'], + \ readfile('Xtestout')) + endif + call delete('Xtestout') endfunc