diff options
author | Bram Moolenaar <Bram@vim.org> | 2020-11-25 13:49:27 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2020-11-25 13:49:27 +0100 |
commit | 448465e6872905967c97a56cd45307530795653c (patch) | |
tree | 444e706bf1aa0d1ec35a1eb36fd22d1c042d7c41 | |
parent | 5ee0981fb5259f94900ab25207caddf1fa61010d (diff) | |
download | vim-git-448465e6872905967c97a56cd45307530795653c.tar.gz |
patch 8.2.2045: highlighting a character too much with incsearchv8.2.2045
Problem: Highlighting a character too much with incsearch.
Solution: Check "search_match_endcol". (Christian Brabandt, closes #7360)
-rw-r--r-- | src/drawline.c | 2 | ||||
-rw-r--r-- | src/testdir/dumps/Test_incsearch_newline1.dump | 5 | ||||
-rw-r--r-- | src/testdir/dumps/Test_incsearch_newline2.dump | 5 | ||||
-rw-r--r-- | src/testdir/dumps/Test_incsearch_newline3.dump | 5 | ||||
-rw-r--r-- | src/testdir/dumps/Test_incsearch_newline4.dump | 5 | ||||
-rw-r--r-- | src/testdir/dumps/Test_incsearch_newline5.dump | 5 | ||||
-rw-r--r-- | src/testdir/test_search.vim | 36 | ||||
-rw-r--r-- | src/version.c | 2 |
8 files changed, 64 insertions, 1 deletions
diff --git a/src/drawline.c b/src/drawline.c index 0b9974216..d51b4c2d6 100644 --- a/src/drawline.c +++ b/src/drawline.c @@ -641,7 +641,7 @@ win_line( else tocol = MAXCOL; // do at least one character; happens when past end of line - if (fromcol == tocol) + if (fromcol == tocol && search_match_endcol) tocol = fromcol + 1; area_highlighting = TRUE; vi_attr = HL_ATTR(HLF_I); diff --git a/src/testdir/dumps/Test_incsearch_newline1.dump b/src/testdir/dumps/Test_incsearch_newline1.dump new file mode 100644 index 000000000..9e9241a1f --- /dev/null +++ b/src/testdir/dumps/Test_incsearch_newline1.dump @@ -0,0 +1,5 @@ +|t+1&#ffffff0|e|s|t| +0&&@5 +|x@2| @6 +|~+0#4040ff13&| @8 +|~| @8 +|/+0#0000000&|t|e|s|t> @4 diff --git a/src/testdir/dumps/Test_incsearch_newline2.dump b/src/testdir/dumps/Test_incsearch_newline2.dump new file mode 100644 index 000000000..677343da5 --- /dev/null +++ b/src/testdir/dumps/Test_incsearch_newline2.dump @@ -0,0 +1,5 @@ +|t+1&#ffffff0|e|s|t| | +0&&@4 +|x@2| @6 +|~+0#4040ff13&| @8 +|~| @8 +|/+0#0000000&|t|e|s|t|\|n> @2 diff --git a/src/testdir/dumps/Test_incsearch_newline3.dump b/src/testdir/dumps/Test_incsearch_newline3.dump new file mode 100644 index 000000000..d80cc7471 --- /dev/null +++ b/src/testdir/dumps/Test_incsearch_newline3.dump @@ -0,0 +1,5 @@ +|t+1&#ffffff0|e|s|t| | +0&&@4 +|x+1&&|x+0&&@1| @6 +|~+0#4040ff13&| @8 +|~| @8 +|/+0#0000000&|t|e|s|t|\|n|x> @1 diff --git a/src/testdir/dumps/Test_incsearch_newline4.dump b/src/testdir/dumps/Test_incsearch_newline4.dump new file mode 100644 index 000000000..50d88b3c3 --- /dev/null +++ b/src/testdir/dumps/Test_incsearch_newline4.dump @@ -0,0 +1,5 @@ +|t+1&#ffffff0|e|s|t| | +0&&@4 +|x+1&&@1|x+0&&| @6 +|~+0#4040ff13&| @8 +|~| @8 +|/+0#0000000&|t|e|s|t|\|n|x@1> diff --git a/src/testdir/dumps/Test_incsearch_newline5.dump b/src/testdir/dumps/Test_incsearch_newline5.dump new file mode 100644 index 000000000..656834873 --- /dev/null +++ b/src/testdir/dumps/Test_incsearch_newline5.dump @@ -0,0 +1,5 @@ +|o+0#00e0003#ffffff0|r| |t|y|p|e| |c|o +|m| @7|m +|a|n|d| |t|o| |c|o|n +|t| @7|i +|n|u|e> +0#0000000&@6 diff --git a/src/testdir/test_search.vim b/src/testdir/test_search.vim index f62914e3e..00b1a15e1 100644 --- 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 diff --git a/src/version.c b/src/version.c index d9b197bdc..ef0e157a6 100644 --- a/src/version.c +++ b/src/version.c @@ -751,6 +751,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 2045, +/**/ 2044, /**/ 2043, |