Skip to content

Commit

Permalink
patch 8.2.4062: match highlighting of tab too short
Browse files Browse the repository at this point in the history
Problem:    Match highlighting of tab too short.
Solution:   Do not stop match highlighting if on a Tab. (Christian Brabandt,
            closes #9507, closes #9500)
  • Loading branch information
brammool committed Jan 11, 2022
1 parent 0d47ad4 commit 0bbca54
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/drawline.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
10 changes: 10 additions & 0 deletions src/testdir/dumps/Test_match_tab_linebreak.dump
Original file line number Diff line number Diff line change
@@ -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|
18 changes: 18 additions & 0 deletions src/testdir/test_match.vim
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 2 additions & 0 deletions src/version.c
Original file line number Diff line number Diff line change
Expand Up @@ -750,6 +750,8 @@ static char *(features[]) =

static int included_patches[] =
{ /* Add new patch number below this line */
/**/
4062,
/**/
4061,
/**/
Expand Down

0 comments on commit 0bbca54

Please sign in to comment.