summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2022-01-11 13:14:54 +0000
committerBram Moolenaar <Bram@vim.org>2022-01-11 13:14:54 +0000
commit0bbca540f7377889e2154aa5731f6eeffcb5c0cc (patch)
tree61cc03237b9266b9c7e436b3997c8110e1b6094d
parent0d47ad40274ed9c7ace636b2a4063182c905a2b4 (diff)
patch 8.2.4062: match highlighting of tab too shortv8.2.4062
Problem: Match highlighting of tab too short. Solution: Do not stop match highlighting if on a Tab. (Christian Brabandt, closes #9507, closes #9500)
-rw-r--r--src/drawline.c5
-rw-r--r--src/testdir/dumps/Test_match_tab_linebreak.dump10
-rw-r--r--src/testdir/test_match.vim18
-rw-r--r--src/version.c2
4 files changed, 33 insertions, 2 deletions
diff --git a/src/drawline.c b/src/drawline.c
index 8a042ed3ea..1cf468137a 100644
--- a/src/drawline.c
+++ b/src/drawline.c
@@ -2043,9 +2043,10 @@ win_line(
if (n_extra < 0)
n_extra = 0;
}
- if (on_last_col)
+ if (on_last_col && c != TAB)
// Do not continue search/match highlighting over the
- // line break.
+ // line break, but for TABs the highlighting should
+ // include the complete width of the character
search_attr = 0;
if (c == TAB && n_extra + col > wp->w_width)
diff --git a/src/testdir/dumps/Test_match_tab_linebreak.dump b/src/testdir/dumps/Test_match_tab_linebreak.dump
new file mode 100644
index 0000000000..9a525d1cf4
--- /dev/null
+++ b/src/testdir/dumps/Test_match_tab_linebreak.dump
@@ -0,0 +1,10 @@
+| +0#ffffff16#e000002@6> |i+0#0000000#ffffff0|x| @64
+|~+0#4040ff13&| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+| +0#0000000&@56|1|,|1|-|8| @8|A|l@1|
diff --git a/src/testdir/test_match.vim b/src/testdir/test_match.vim
index 0af45a49a7..a912b78a12 100644
--- a/src/testdir/test_match.vim
+++ b/src/testdir/test_match.vim
@@ -407,4 +407,22 @@ func Test_matchdelete_redraw()
bw!
endfunc
+func Test_match_tab_with_linebreak()
+ CheckRunVimInTerminal
+
+ let lines =<< trim END
+ set linebreak
+ call setline(1, "\tix")
+ call matchadd('ErrorMsg', '\t')
+ END
+ call writefile(lines, 'XscriptMatchTabLinebreak')
+ let buf = RunVimInTerminal('-S XscriptMatchTabLinebreak', #{rows: 10})
+ call TermWait(buf)
+ call VerifyScreenDump(buf, 'Test_match_tab_linebreak', {})
+
+ call StopVimInTerminal(buf)
+ call delete('XscriptMatchTabLinebreak')
+endfunc
+
+
" vim: shiftwidth=2 sts=2 expandtab
diff --git a/src/version.c b/src/version.c
index 3fe45ea4c4..36525af3db 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 */
/**/
+ 4062,
+/**/
4061,
/**/
4060,