]> granicus.if.org Git - vim/commitdiff
patch 8.1.0339: wrong highlight when 'incsearch' set and cancelling :s v8.1.0339
authorBram Moolenaar <Bram@vim.org>
Fri, 31 Aug 2018 20:09:54 +0000 (22:09 +0200)
committerBram Moolenaar <Bram@vim.org>
Fri, 31 Aug 2018 20:09:54 +0000 (22:09 +0200)
Problem:    Wrong highlight when 'incsearch' set and cancelling :s.
Solution:   Reset search line range. (Hirohito Higashi, Masamichi Abe)

src/ex_getln.c
src/testdir/dumps/Test_incsearch_substitute_10.dump [new file with mode: 0644]
src/testdir/test_search.vim
src/version.c

index 7f748cb17d12bccbb22a97b8de6fd003b697402b..c316e192ad5f92a896f705cb4f610b21b701330d 100644 (file)
@@ -436,12 +436,18 @@ finish_incsearch_highlighting(
        }
        restore_viewstate(&is_state->old_viewstate);
        highlight_match = FALSE;
+
+       // by default search all lines
+       search_first_line = 0;
+       search_last_line = MAXLNUM;
+
+       p_magic = is_state->magic_save;
+
        validate_cursor();      /* needed for TAB */
        if (call_update_screen)
            update_screen(SOME_VALID);
        else
            redraw_all_later(SOME_VALID);
-       p_magic = is_state->magic_save;
     }
 }
 
diff --git a/src/testdir/dumps/Test_incsearch_substitute_10.dump b/src/testdir/dumps/Test_incsearch_substitute_10.dump
new file mode 100644 (file)
index 0000000..f98e046
--- /dev/null
@@ -0,0 +1,9 @@
+|f+0&#ffff4012|o@1| +0&#ffffff0|1| @64
+>f+0&#ffff4012|o@1| +0&#ffffff0|2| @64
+|f+0&#ffff4012|o@1| +0&#ffffff0|3| @64
+|f+0&#ffff4012|o@1| +0&#ffffff0|4| @64
+|f+0&#ffff4012|o@1| +0&#ffffff0|5| @64
+|f+0&#ffff4012|o@1| +0&#ffffff0|6| @64
+|f+0&#ffff4012|o@1| +0&#ffffff0|7| @64
+|f+0&#ffff4012|o@1| +0&#ffffff0|8| @64
+@52|2|,|1| @10|T|o|p| 
index b998cc47b617021da8b76233118f6fba62b0a8c3..68dc3ec8e8d0d05f55ba61f75499191dd8d7fbfb 100644 (file)
@@ -956,6 +956,15 @@ func Test_incsearch_substitute_dump()
   call VerifyScreenDump(buf, 'Test_incsearch_substitute_09', {})
   call term_sendkeys(buf, "\<Esc>")
 
+  call term_sendkeys(buf, ":set nocursorline\<CR>")
+
+  " All matches are highlighted for 'hlsearch' after the incsearch canceled
+  call term_sendkeys(buf, "1G*")
+  call term_sendkeys(buf, ":2,5s/foo")
+  sleep 100m
+  call term_sendkeys(buf, "\<Esc>")
+  call VerifyScreenDump(buf, 'Test_incsearch_substitute_10', {})
+
   call StopVimInTerminal(buf)
   call delete('Xis_subst_script')
 endfunc
index 7dd15914e5f084e57d0b867cf273302f114206d3..ec13271baf24c95aa644665965d3f9d623aca930 100644 (file)
@@ -794,6 +794,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    339,
 /**/
     338,
 /**/