]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 8.1.0734: the hlsearch state is not stored in a session file v8.1.0734
authorBram Moolenaar <Bram@vim.org>
Sat, 12 Jan 2019 15:29:30 +0000 (16:29 +0100)
committerBram Moolenaar <Bram@vim.org>
Sat, 12 Jan 2019 15:29:30 +0000 (16:29 +0100)
Problem:    The hlsearch state is not stored in a session file.
Solution:   Add "nohlsearch" if appropriate. (Jason Franklin)

src/ex_docmd.c
src/testdir/test_mksession.vim
src/version.c

index 354cc119b6c84b47fc7646fb123698f23464c345..7dc61982054bbd7d28f7b045444cc97d02fc30e6 100644 (file)
@@ -10144,6 +10144,10 @@ ex_mkrc(
            if (put_line(fd, "let &so = s:so_save | let &siso = s:siso_save")
                                                                      == FAIL)
                failed = TRUE;
+# ifdef FEAT_SEARCH_EXTRA
+           if (no_hlsearch && put_line(fd, "nohlsearch") == FAIL)
+               failed = TRUE;
+# endif
            if (put_line(fd, "doautoall SessionLoadPost") == FAIL)
                failed = TRUE;
            if (eap->cmdidx == CMD_mksession)
index fa08685acdf033c97cd9bed5d4a2b3f9e8b660e2..4d524da0dc26a47a6ae7825849108b2b6e940348 100644 (file)
@@ -198,6 +198,24 @@ func Test_mksession_blank_tabs()
   call delete('Xtest_mks.out')
 endfunc
 
+if has('extra_search')
+
+func Test_mksession_hlsearch()
+  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')
+  call delete('Xtest_mks.out')
+endfunc
+
+endif
+
+
 func Test_mksession_blank_windows()
   split
   split
index a967fea42584789e4b5b4c30d728a27349569239..11b555fcf70613a6c2cc4ad60ca5aba459c635b0 100644 (file)
@@ -795,6 +795,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    734,
 /**/
     733,
 /**/