From 5ce328df401bc5cafd66caeb265835b939028b7f Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Thu, 17 Dec 2020 21:13:17 -0500 Subject: [PATCH] vim-patch:8.1.0734: the hlsearch state is not stored in a session file (#13547) Problem: The hlsearch state is not stored in a session file. Solution: Add "nohlsearch" if appropriate. (Jason Franklin) https://github.com/vim/vim/commit/e3c74d249ac36404d8af25f74baf335d143b30e3 Vi default for 'sessionoptions' includes 'options'. Use 'set sessionoptions&vi' to use Vim's default 'sessionoptions'. If a test sets 'sessionoptions', reset 'sessionoptions' at the end of the test. N/A patches for version.c: vim-patch:8.2.0119: message test fails on some platforms Problem: Message test fails on some platforms. (Elimar Riesebieter) Solution: Add type cast to vim_snprintf() argument. (Dominique Pelle) https://github.com/vim/vim/commit/1470dc35c4b14bda1995b7566c9a41a33eb06517 vim-patch:8.2.0234: message test fails on SunOS Problem: Message test fails on SunOS. Solution: Adjust expectation for printf "%p". (Ozaki Kiichi, closes vim/vim#5595) https://github.com/vim/vim/commit/d5b991493816a2edba7cacdd06820cf3c0abc4dc vim-patch:8.2.2149: popupwin test for latin1 sometimes fails Problem: Popupwin test for latin1 sometimes fails. Solution: Wait for the script to finish. https://github.com/vim/vim/commit/4c5bdb99ad632d703e94fffafba11b91861fea48 vim-patch:8.2.2150: Github actions CI isn't used for all available platforms Problem: Github actions CI isn't used for all available platforms. Solution: Update the github workflows. (Ozaki Kiichi, closes vim/vim#7433) https://github.com/vim/vim/commit/8ea05de6aa1d133cba3381bcc36adf1736b08e00 vim-patch:8.2.2151: $dir not expanded when configure checks for moonjit Problem: $dir not expanded when configure checks for moonjit. Solution: Use double quotes instead of single quotes. (closes vim/vim#7478) https://github.com/vim/vim/commit/a79a8944dade9115ccaa5a06a076dfb257e56c62 vim-patch:8.2.2153: popupwin test for latin1 still fails sometimes Problem: Popupwin test for latin1 still fails sometimes. Solution: Wait for the "cat" command to finish. https://github.com/vim/vim/commit/b125b535bb0456ab43c10683307a4bc359442d44 vim-patch:8.2.2154: popupwin test for terminal buffer fails sometimes Problem: Popupwin test for terminal buffer fails sometimes. Solution: Wait for the prompt to appear. https://github.com/vim/vim/commit/0353f56ddb379e7f1a68172fa4743355e04df21e --- src/nvim/ex_session.c | 12 ++++++++++-- src/nvim/testdir/setup.vim | 1 + src/nvim/testdir/test_mksession.vim | 23 ++++++++++++++++++++++- 3 files changed, 33 insertions(+), 3 deletions(-) diff --git a/src/nvim/ex_session.c b/src/nvim/ex_session.c index 42a9ef08f9..d831ffc050 100644 --- a/src/nvim/ex_session.c +++ b/src/nvim/ex_session.c @@ -893,6 +893,9 @@ void ex_mkrc(exarg_T *eap) && (*flagp & SSOP_OPTIONS))) { failed |= (makemap(fd, NULL) == FAIL || makeset(fd, OPT_GLOBAL, false) == FAIL); + if (p_hls && fprintf(fd, "%s", "set hlsearch\n") < 0) { + failed = true; + } } if (!failed && view_session) { @@ -949,11 +952,16 @@ void ex_mkrc(exarg_T *eap) } if (fprintf(fd, "%s", - "let &g:so = s:so_save | let &g:siso = s:siso_save\n" - "doautoall SessionLoadPost\n") + "let &g:so = s:so_save | let &g:siso = s:siso_save\n") < 0) { failed = true; } + if (no_hlsearch && fprintf(fd, "%s", "nohlsearch\n") < 0) { + failed = true; + } + if (fprintf(fd, "%s", "doautoall SessionLoadPost\n") < 0) { + failed = true; + } if (eap->cmdidx == CMD_mksession) { if (fprintf(fd, "unlet SessionLoad\n") < 0) { failed = true; diff --git a/src/nvim/testdir/setup.vim b/src/nvim/testdir/setup.vim index d032c9a739..fd9cfb54be 100644 --- a/src/nvim/testdir/setup.vim +++ b/src/nvim/testdir/setup.vim @@ -20,6 +20,7 @@ set tags=./tags,tags set undodir^=. set wildoptions= set startofline +set sessionoptions&vi " Prevent Nvim log from writing to stderr. let $NVIM_LOG_FILE = exists($NVIM_LOG_FILE) ? $NVIM_LOG_FILE : 'Xnvim.log' diff --git a/src/nvim/testdir/test_mksession.vim b/src/nvim/testdir/test_mksession.vim index 215065f941..8ef8bbc23a 100644 --- a/src/nvim/testdir/test_mksession.vim +++ b/src/nvim/testdir/test_mksession.vim @@ -128,6 +128,7 @@ func Test_mksession() call delete('Xtest_mks.out') call delete(tmpfile) let &wrap = wrap_save + set sessionoptions& endfunc func Test_mksession_winheight() @@ -154,7 +155,7 @@ func Test_mksession_rtp() return endif new - set sessionoptions+=options + set sessionoptions&vi let _rtp=&rtp " Make a real long (invalid) runtimepath value, " that should exceed PATH_MAX (hopefully) @@ -174,6 +175,7 @@ func Test_mksession_rtp() call assert_equal(expected, li) call delete('Xtest_mks.out') + set sessionoptions& endfunc " Verify that arglist is stored correctly to the session file. @@ -218,6 +220,25 @@ func Test_mksession_one_buffer_two_windows() call delete('Xtest_mks.out') endfunc +if has('extra_search') + +func Test_mksession_hlsearch() + set sessionoptions&vi + set hlsearch + mksession! Xtest_mks.out + nohlsearch + source Xtest_mks.out + call assert_equal(1, v:hlsearch, 'session should restore search highlighting state') + nohlsearch + mksession! Xtest_mks.out + source Xtest_mks.out + call assert_equal(0, v:hlsearch, 'session should restore search highlighting state') + set sessionoptions& + call delete('Xtest_mks.out') +endfunc + +endif + " Test :mkview with a file argument. func Test_mkview_file() " Create a view with line number and a fold.