• R/O
  • SSH

vim: Commit

Mirror of the Vim source from https://github.com/vim/vim


Commit MetaInfo

Révision00548e40e708e65f46565a92b50655927b5a8785 (tree)
l'heure2020-11-25 22:00:04
AuteurBram Moolenaar <Bram@vim....>
CommiterBram Moolenaar

Message de Log

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)

Change Summary

Modification

diff -r 00ca79a2ae52 -r 00548e40e708 src/drawline.c
--- a/src/drawline.c Wed Nov 25 12:45:04 2020 +0100
+++ b/src/drawline.c Wed Nov 25 14:00:04 2020 +0100
@@ -641,7 +641,7 @@
641641 else
642642 tocol = MAXCOL;
643643 // do at least one character; happens when past end of line
644- if (fromcol == tocol)
644+ if (fromcol == tocol && search_match_endcol)
645645 tocol = fromcol + 1;
646646 area_highlighting = TRUE;
647647 vi_attr = HL_ATTR(HLF_I);
diff -r 00ca79a2ae52 -r 00548e40e708 src/testdir/dumps/Test_incsearch_newline1.dump
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/testdir/dumps/Test_incsearch_newline1.dump Wed Nov 25 14:00:04 2020 +0100
@@ -0,0 +1,5 @@
1+|t+1&#ffffff0|e|s|t| +0&&@5
2+|x@2| @6
3+|~+0#4040ff13&| @8
4+|~| @8
5+|/+0#0000000&|t|e|s|t> @4
diff -r 00ca79a2ae52 -r 00548e40e708 src/testdir/dumps/Test_incsearch_newline2.dump
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/testdir/dumps/Test_incsearch_newline2.dump Wed Nov 25 14:00:04 2020 +0100
@@ -0,0 +1,5 @@
1+|t+1&#ffffff0|e|s|t| | +0&&@4
2+|x@2| @6
3+|~+0#4040ff13&| @8
4+|~| @8
5+|/+0#0000000&|t|e|s|t|\|n> @2
diff -r 00ca79a2ae52 -r 00548e40e708 src/testdir/dumps/Test_incsearch_newline3.dump
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/testdir/dumps/Test_incsearch_newline3.dump Wed Nov 25 14:00:04 2020 +0100
@@ -0,0 +1,5 @@
1+|t+1&#ffffff0|e|s|t| | +0&&@4
2+|x+1&&|x+0&&@1| @6
3+|~+0#4040ff13&| @8
4+|~| @8
5+|/+0#0000000&|t|e|s|t|\|n|x> @1
diff -r 00ca79a2ae52 -r 00548e40e708 src/testdir/dumps/Test_incsearch_newline4.dump
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/testdir/dumps/Test_incsearch_newline4.dump Wed Nov 25 14:00:04 2020 +0100
@@ -0,0 +1,5 @@
1+|t+1&#ffffff0|e|s|t| | +0&&@4
2+|x+1&&@1|x+0&&| @6
3+|~+0#4040ff13&| @8
4+|~| @8
5+|/+0#0000000&|t|e|s|t|\|n|x@1>
diff -r 00ca79a2ae52 -r 00548e40e708 src/testdir/dumps/Test_incsearch_newline5.dump
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/testdir/dumps/Test_incsearch_newline5.dump Wed Nov 25 14:00:04 2020 +0100
@@ -0,0 +1,5 @@
1+|o+0#00e0003#ffffff0|r| |t|y|p|e| |c|o
2+|m| @7|m
3+|a|n|d| |t|o| |c|o|n
4+|t| @7|i
5+|n|u|e> +0#0000000&@6
diff -r 00ca79a2ae52 -r 00548e40e708 src/testdir/test_search.vim
--- a/src/testdir/test_search.vim Wed Nov 25 12:45:04 2020 +0100
+++ b/src/testdir/test_search.vim Wed Nov 25 14:00:04 2020 +0100
@@ -1776,4 +1776,40 @@
17761776 close!
17771777 endfunc
17781778
1779+func Test_zzzz_incsearch_highlighting_newline()
1780+ CheckRunVimInTerminal
1781+ CheckOption incsearch
1782+ CheckScreendump
1783+ new
1784+ call test_override("char_avail", 1)
1785+
1786+ let commands =<< trim [CODE]
1787+ set incsearch nohls
1788+ call setline(1, ['test', 'xxx'])
1789+ [CODE]
1790+ call writefile(commands, 'Xincsearch_nl')
1791+ let buf = RunVimInTerminal('-S Xincsearch_nl', {'rows': 5, 'cols': 10})
1792+ " Need to send one key at a time to force a redraw
1793+ call term_sendkeys(buf, '/test')
1794+ sleep 100m
1795+ call VerifyScreenDump(buf, 'Test_incsearch_newline1', {})
1796+ call term_sendkeys(buf, '\n')
1797+ sleep 100m
1798+ call VerifyScreenDump(buf, 'Test_incsearch_newline2', {})
1799+ call term_sendkeys(buf, 'x')
1800+ sleep 100m
1801+ call VerifyScreenDump(buf, 'Test_incsearch_newline3', {})
1802+ call term_sendkeys(buf, 'x')
1803+ call VerifyScreenDump(buf, 'Test_incsearch_newline4', {})
1804+ call term_sendkeys(buf, "\<CR>")
1805+ sleep 100m
1806+ call VerifyScreenDump(buf, 'Test_incsearch_newline5', {})
1807+ call StopVimInTerminal(buf)
1808+
1809+ " clean up
1810+ call delete('Xincsearch_nl')
1811+ call test_override("char_avail", 0)
1812+ bw
1813+endfunc
1814+
17791815 " vim: shiftwidth=2 sts=2 expandtab
diff -r 00ca79a2ae52 -r 00548e40e708 src/version.c
--- a/src/version.c Wed Nov 25 12:45:04 2020 +0100
+++ b/src/version.c Wed Nov 25 14:00:04 2020 +0100
@@ -751,6 +751,8 @@
751751 static int included_patches[] =
752752 { /* Add new patch number below this line */
753753 /**/
754+ 2045,
755+/**/
754756 2044,
755757 /**/
756758 2043,
Afficher sur ancien navigateur de dépôt.