diff src/testdir/test_search.vim @ 22997:00548e40e708 v8.2.2045

patch 8.2.2045: highlighting a character too much with incsearch Commit: https://github.com/vim/vim/commit/448465e6872905967c97a56cd45307530795653c Author: Bram Moolenaar <Bram@vim.org> Date: Wed Nov 25 13:49:27 2020 +0100 patch 8.2.2045: highlighting a character too much with incsearch Problem: Highlighting a character too much with incsearch. Solution: Check "search_match_endcol". (Christian Brabandt, closes https://github.com/vim/vim/issues/7360)
author Bram Moolenaar <Bram@vim.org>
date Wed, 25 Nov 2020 14:00:04 +0100
parents 5193420617f1
children 7cb072acc5c0
line wrap: on
line diff
--- a/src/testdir/test_search.vim
+++ b/src/testdir/test_search.vim
@@ -1776,4 +1776,40 @@ func Test_search_stopline()
   close!
 endfunc
 
+func Test_zzzz_incsearch_highlighting_newline()
+  CheckRunVimInTerminal
+  CheckOption incsearch
+  CheckScreendump
+  new
+  call test_override("char_avail", 1)
+
+  let commands =<< trim [CODE]
+    set incsearch nohls
+    call setline(1, ['test', 'xxx'])
+  [CODE]
+  call writefile(commands, 'Xincsearch_nl')
+  let buf = RunVimInTerminal('-S Xincsearch_nl', {'rows': 5, 'cols': 10})
+  " Need to send one key at a time to force a redraw
+  call term_sendkeys(buf, '/test')
+  sleep 100m
+  call VerifyScreenDump(buf, 'Test_incsearch_newline1', {})
+  call term_sendkeys(buf, '\n')
+  sleep 100m
+  call VerifyScreenDump(buf, 'Test_incsearch_newline2', {})
+  call term_sendkeys(buf, 'x')
+  sleep 100m
+  call VerifyScreenDump(buf, 'Test_incsearch_newline3', {})
+  call term_sendkeys(buf, 'x')
+  call VerifyScreenDump(buf, 'Test_incsearch_newline4', {})
+  call term_sendkeys(buf, "\<CR>")
+  sleep 100m
+  call VerifyScreenDump(buf, 'Test_incsearch_newline5', {})
+  call StopVimInTerminal(buf)
+
+  " clean up
+  call delete('Xincsearch_nl')
+  call test_override("char_avail", 0)
+  bw
+endfunc
+
 " vim: shiftwidth=2 sts=2 expandtab