]> granicus.if.org Git - vim/commitdiff
patch 8.1.0321: 'incsearch' regression: /\v highlights everything v8.1.0321
authorBram Moolenaar <Bram@vim.org>
Thu, 23 Aug 2018 18:55:45 +0000 (20:55 +0200)
committerBram Moolenaar <Bram@vim.org>
Thu, 23 Aug 2018 18:55:45 +0000 (20:55 +0200)
Problem:    'incsearch' regression: /\v highlights everything.
Solution:   Put back the empty_pattern() check.

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

index 1cb3c8b7a1cfab630bca7d5ec1765d47dcb0a35b..7f748cb17d12bccbb22a97b8de6fd003b697402b 100644 (file)
@@ -572,6 +572,17 @@ may_do_incsearch_highlighting(
     else
        end_pos = curwin->w_cursor; // shutup gcc 4
 
+    // Disable 'hlsearch' highlighting if the pattern matches everything.
+    // Avoids a flash when typing "foo\|".
+    if (!use_last_pat)
+    {
+       next_char = ccline.cmdbuff[skiplen + patlen];
+       ccline.cmdbuff[skiplen + patlen] = NUL;
+       if (empty_pattern(ccline.cmdbuff))
+           set_no_hlsearch(TRUE);
+       ccline.cmdbuff[skiplen + patlen] = next_char;
+    }
+
     validate_cursor();
     // May redraw the status line to show the cursor position.
     if (p_ru && curwin->w_status_height > 0)
diff --git a/src/testdir/dumps/Test_incsearch_search_01.dump b/src/testdir/dumps/Test_incsearch_search_01.dump
new file mode 100644 (file)
index 0000000..324abfe
--- /dev/null
@@ -0,0 +1,9 @@
+|f+0&#ffff4012|o|o+0&#ffffff0| |1| @64
+|f+0&#ffff4012|o|o+0&#ffffff0| |2| @64
+|f+0&#ffff4012|o|o+0&#ffffff0| |3| @64
+|f+1&&|o|o+0&&| |4| @64
+|f+0&#ffff4012|o|o+0&#ffffff0| |5| @64
+|f+0&#ffff4012|o|o+0&#ffffff0| |6| @64
+|f+0&#ffff4012|o|o+0&#ffffff0| |7| @64
+|f+0&#ffff4012|o|o+0&#ffffff0| |8| @64
+|/|f|o> @66
diff --git a/src/testdir/dumps/Test_incsearch_search_02.dump b/src/testdir/dumps/Test_incsearch_search_02.dump
new file mode 100644 (file)
index 0000000..6c1b743
--- /dev/null
@@ -0,0 +1,9 @@
+|f+0&#ffffff0|o@1| |1| @64
+|f|o@1| |2| @64
+|f|o+1&&|o+0&&| |3| @64
+|f|o@1| |4| @64
+|f|o@1| |5| @64
+|f|o@1| |6| @64
+|f|o@1| |7| @64
+|f|o@1| |8| @64
+|/|\|v> @66
index ba2d21a6e68515ff0af7f3a652ee65b8efdf01ac..b998cc47b617021da8b76233118f6fba62b0a8c3 100644 (file)
@@ -813,6 +813,41 @@ func Test_incsearch_scrolling()
   call delete('Xscript')
 endfunc
 
+func Test_incsearch_search_dump()
+  if !exists('+incsearch')
+    return
+  endif
+  if !CanRunVimInTerminal()
+    return
+  endif
+  call writefile([
+       \ 'set incsearch hlsearch scrolloff=0',
+       \ 'for n in range(1, 8)',
+       \ '  call setline(n, "foo " . n)',
+       \ 'endfor',
+       \ '3',
+       \ ], 'Xis_search_script')
+  let buf = RunVimInTerminal('-S Xis_search_script', {'rows': 9, 'cols': 70})
+  " Give Vim a chance to redraw to get rid of the spaces in line 2 caused by
+  " the 'ambiwidth' check.
+  sleep 100m
+
+  " Need to send one key at a time to force a redraw.
+  call term_sendkeys(buf, '/fo')
+  sleep 100m
+  call VerifyScreenDump(buf, 'Test_incsearch_search_01', {})
+  call term_sendkeys(buf, "\<Esc>")
+  sleep 100m
+
+  call term_sendkeys(buf, '/\v')
+  sleep 100m
+  call VerifyScreenDump(buf, 'Test_incsearch_search_02', {})
+  call term_sendkeys(buf, "\<Esc>")
+
+  call StopVimInTerminal(buf)
+  call delete('Xis_search_script')
+endfunc
+
 func Test_incsearch_substitute()
   if !exists('+incsearch')
     return
@@ -926,7 +961,7 @@ func Test_incsearch_substitute_dump()
 endfunc
 
 " Similar to Test_incsearch_substitute_dump() for :sort
-func Test_incsearch_ssort_dump()
+func Test_incsearch_sort_dump()
   if !exists('+incsearch')
     return
   endif
index d31f9e0f9a7206e3ad675b347a5b4f30edeb3f2b..38afc4f351d93fcca1c02d54fcad796ec257eb6b 100644 (file)
@@ -794,6 +794,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    321,
 /**/
     320,
 /**/