Hi Bram and developers,

Preparation:
- Prepare a file with the following contents.  (Six lines)
  $ cat a.txt
foo
foo
foo
foo
foo
foo

How to reproduce:
- Start vanilla Vim with hlsearch and incsearch
  $ vim --clean +"set hls is" a.txt
- Search the keyword under the cursor.  (All 'foo' are highlighted)
  *
- Do incsearch in :s command with range 2 to 5 lines.
  :2,5s/foo
- Cancel incseach.
  Hit <Esc> key

Expected behavior:
- All 'foo' are highlighted.

Actual behavior:
- Only 2 to 5 lines are highlighted.


Patch attached.
Please check it out.

NOTE:
This issue was reported by Masamichi Abe.
And he wrote a first patch.
I fixed a bit patch and added test.

This patch reviewed by Ozaki Kiichi (ichizok).  Thanks!

--
Best regards,
Hirohito Higashi (h_east)

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.
diff --git a/src/ex_getln.c b/src/ex_getln.c
index 7f748cb17..c316e192a 100644
--- a/src/ex_getln.c
+++ b/src/ex_getln.c
@@ -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
index 000000000..f98e0468c
--- /dev/null
+++ b/src/testdir/dumps/Test_incsearch_substitute_10.dump
@@ -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| 
diff --git a/src/testdir/test_search.vim b/src/testdir/test_search.vim
index b998cc47b..917525adc 100644
--- a/src/testdir/test_search.vim
+++ b/src/testdir/test_search.vim
@@ -956,6 +956,14 @@ 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\<Esc>")
+  sleep 100m
+  call VerifyScreenDump(buf, 'Test_incsearch_substitute_10', {})
+
   call StopVimInTerminal(buf)
   call delete('Xis_subst_script')
 endfunc

Raspunde prin e-mail lui