summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2018-08-14 18:16:52 +0200
committerBram Moolenaar <Bram@vim.org>2018-08-14 18:16:52 +0200
commit2f6a346a4cd2d5bdd6dc9b3209ebce7b6340221d (patch)
tree9fcf5bd2bd4297a2b80608ae0f70aa68a259081a
parent80d83c094d52b9983ef316b1a08c314060ca8313 (diff)
downloadvim-git-8.1.0284.tar.gz
patch 8.1.0284: 'cursorline' highlighting wrong with 'incsearch'v8.1.0284
Problem: 'cursorline' highlighting wrong with 'incsearch'. Solution: Move the cursor back if the match is outside the range.
-rw-r--r--src/ex_getln.c3
-rw-r--r--src/testdir/dumps/Test_incsearch_substitute_07.dump9
-rw-r--r--src/testdir/dumps/Test_incsearch_substitute_08.dump9
-rw-r--r--src/testdir/test_search.vim15
-rw-r--r--src/version.c2
5 files changed, 38 insertions, 0 deletions
diff --git a/src/ex_getln.c b/src/ex_getln.c
index a8c5cfb00..ba6fe729c 100644
--- a/src/ex_getln.c
+++ b/src/ex_getln.c
@@ -480,8 +480,11 @@ may_do_incsearch_highlighting(
if (curwin->w_cursor.lnum < search_first_line
|| curwin->w_cursor.lnum > search_last_line)
+ {
// match outside of address range
i = 0;
+ curwin->w_cursor = is_state->search_start;
+ }
// if interrupted while searching, behave like it failed
if (got_int)
diff --git a/src/testdir/dumps/Test_incsearch_substitute_07.dump b/src/testdir/dumps/Test_incsearch_substitute_07.dump
new file mode 100644
index 000000000..7b4dc6e14
--- /dev/null
+++ b/src/testdir/dumps/Test_incsearch_substitute_07.dump
@@ -0,0 +1,9 @@
+|f+0&#ffffff0|o@1| |4| @64
+|f|o@1| |5| @64
+|f|o@1| |6| @64
+|f|o@1| |7| @64
+|f|o@1| |8| @64
+|f|o@1| |9| @64
+|f|o@1| |1|0| @63
+|b+9&&|a|r| +8&&|1@1| @63
+|:+0&&|9|,|1@1|s|/|b|a|r> @59
diff --git a/src/testdir/dumps/Test_incsearch_substitute_08.dump b/src/testdir/dumps/Test_incsearch_substitute_08.dump
new file mode 100644
index 000000000..d87e507b2
--- /dev/null
+++ b/src/testdir/dumps/Test_incsearch_substitute_08.dump
@@ -0,0 +1,9 @@
+|f+0&#ffffff0|o@1| |4| @64
+|f|o@1| |5| @64
+|f|o@1| |6| @64
+|f|o@1| |7| @64
+|f|o@1| |8| @64
+|f+8&&|o@1| |9| @64
+|f+0&&|o@1| |1|0| @63
+|b|a|r| |1@1| @63
+|:|9|,|1|0|s|/|b|a|r> @59
diff --git a/src/testdir/test_search.vim b/src/testdir/test_search.vim
index 851811b19..a36b4fbcd 100644
--- a/src/testdir/test_search.vim
+++ b/src/testdir/test_search.vim
@@ -839,6 +839,7 @@ func Test_incsearch_substitute_dump()
\ 'for n in range(1, 10)',
\ ' call setline(n, "foo " . n)',
\ 'endfor',
+ \ 'call setline(11, "bar 11")',
\ '3',
\ ], 'Xis_subst_script')
let buf = RunVimInTerminal('-S Xis_subst_script', {'rows': 9, 'cols': 70})
@@ -890,6 +891,20 @@ func Test_incsearch_substitute_dump()
call VerifyScreenDump(buf, 'Test_incsearch_substitute_06', {})
call term_sendkeys(buf, "\<Esc>")
+ " Cursorline highlighting at match
+ call term_sendkeys(buf, ":set cursorline\<CR>")
+ call term_sendkeys(buf, 'G9G')
+ call term_sendkeys(buf, ':9,11s/bar')
+ sleep 100m
+ call VerifyScreenDump(buf, 'Test_incsearch_substitute_07', {})
+ call term_sendkeys(buf, "\<Esc>")
+
+ " Cursorline highlighting at cursor when no match
+ call term_sendkeys(buf, ':9,10s/bar')
+ sleep 100m
+ call VerifyScreenDump(buf, 'Test_incsearch_substitute_08', {})
+ call term_sendkeys(buf, "\<Esc>")
+
call StopVimInTerminal(buf)
call delete('Xis_subst_script')
endfunc
diff --git a/src/version.c b/src/version.c
index 005cce6b4..18051faa3 100644
--- a/src/version.c
+++ b/src/version.c
@@ -795,6 +795,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 284,
+/**/
283,
/**/
282,