changeset 15452:1c6a708a5fee v8.1.0734

patch 8.1.0734: the hlsearch state is not stored in a session file commit https://github.com/vim/vim/commit/e3c74d249ac36404d8af25f74baf335d143b30e3 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Jan 12 16:29:30 2019 +0100 patch 8.1.0734: the hlsearch state is not stored in a session file Problem: The hlsearch state is not stored in a session file. Solution: Add "nohlsearch" if appropriate. (Jason Franklin)
author Bram Moolenaar <Bram@vim.org>
date Sat, 12 Jan 2019 16:30:05 +0100
parents 8ab318043c9f
children cdee6e827112
files src/ex_docmd.c src/testdir/test_mksession.vim src/version.c
diffstat 3 files changed, 24 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -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)
--- a/src/testdir/test_mksession.vim
+++ b/src/testdir/test_mksession.vim
@@ -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
--- a/src/version.c
+++ b/src/version.c
@@ -796,6 +796,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    734,
+/**/
     733,
 /**/
     732,