forked from aniani/vim
patch 9.0.1749: Text property highlight doesn't override a sign highlight on TAB
Problem: Text property highlight doesn't override a sign highlight over
a tab character
Solution: Let text_property override tab highlighting
This fixes a few problems of text properties:
- text property highlighting when override=true does not overwrite TAB
highlighting
- text property highlighting when override=true does not overwrite TAB
highlighting with :set list
- text property highlighting is used instead of sign highlight after
the actual text ends when signs are present with linehl is set
closes: #21584
closes: #21592
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
@@ -2009,7 +2009,13 @@ win_line(
|
|||||||
++text_prop_next;
|
++text_prop_next;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wlv.n_extra == 0 || !wlv.extra_for_textprop)
|
if (wlv.n_extra == 0 ||
|
||||||
|
(!wlv.extra_for_textprop
|
||||||
|
#ifdef FEAT_PROP_POPUP
|
||||||
|
&& !(text_prop_type != NULL &&
|
||||||
|
text_prop_flags & PT_FLAG_OVERRIDE)
|
||||||
|
#endif
|
||||||
|
))
|
||||||
{
|
{
|
||||||
text_prop_attr = 0;
|
text_prop_attr = 0;
|
||||||
text_prop_attr_comb = 0;
|
text_prop_attr_comb = 0;
|
||||||
@@ -3278,6 +3284,12 @@ win_line(
|
|||||||
n_attr = wlv.n_extra + 1;
|
n_attr = wlv.n_extra + 1;
|
||||||
wlv.extra_attr = hl_combine_attr(wlv.win_attr,
|
wlv.extra_attr = hl_combine_attr(wlv.win_attr,
|
||||||
HL_ATTR(HLF_8));
|
HL_ATTR(HLF_8));
|
||||||
|
#ifdef FEAT_PROP_POPUP
|
||||||
|
if (text_prop_type != NULL &&
|
||||||
|
text_prop_flags & PT_FLAG_OVERRIDE)
|
||||||
|
wlv.extra_attr = hl_combine_attr(text_prop_attr, wlv.extra_attr);
|
||||||
|
#endif
|
||||||
|
|
||||||
saved_attr2 = wlv.char_attr; // save current attr
|
saved_attr2 = wlv.char_attr; // save current attr
|
||||||
}
|
}
|
||||||
mb_utf8 = FALSE; // don't draw as UTF-8
|
mb_utf8 = FALSE; // don't draw as UTF-8
|
||||||
@@ -3329,6 +3341,11 @@ win_line(
|
|||||||
|| (wp->w_p_list &&
|
|| (wp->w_p_list &&
|
||||||
wp->w_lcs_chars.eol > 0)))
|
wp->w_lcs_chars.eol > 0)))
|
||||||
wlv.char_attr = wlv.line_attr;
|
wlv.char_attr = wlv.line_attr;
|
||||||
|
#ifdef FEAT_SIGNS
|
||||||
|
// At end of line: if Sign is present with line highlight, reset char_attr
|
||||||
|
if (sign_present && wlv.sattr.sat_linehl > 0 && wlv.draw_state == WL_LINE)
|
||||||
|
wlv.char_attr = wlv.sattr.sat_linehl;
|
||||||
|
#endif
|
||||||
# ifdef FEAT_DIFF
|
# ifdef FEAT_DIFF
|
||||||
if (wlv.diff_hlf == HLF_TXD)
|
if (wlv.diff_hlf == HLF_TXD)
|
||||||
{
|
{
|
||||||
|
|||||||
8
src/testdir/dumps/Test_prop_sign_tab_1.dump
Normal file
8
src/testdir/dumps/Test_prop_sign_tab_1.dump
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
| +0#0000e05#a8a8a8255@1>o+0#0000000#ffff4012|n|e| +0&#ffffff0@54
|
||||||
|
|>@1| +0&#ffff4012@7|t|a|b| +0fd7ff255@46
|
||||||
|
|>+0&#ffffff0@1| +0&#ffff4012@7|s|p|a|c|e| +0fd7ff255@44
|
||||||
|
|X+3&#ffffff0|b|u|f@1|e|r| |[|+|]| @30|1|,|1| @11|T|o|p
|
||||||
|
| +0&&@59
|
||||||
|
|~+0#4040ff13&| @58
|
||||||
|
|[+1#0000000&|N|o| |N|a|m|e|]| @32|0|,|0|-|1| @9|A|l@1
|
||||||
|
|"+0&&|X|b|u|f@1|e|r|"| |[|N|e|w|]| @44
|
||||||
8
src/testdir/dumps/Test_prop_sign_tab_2.dump
Normal file
8
src/testdir/dumps/Test_prop_sign_tab_2.dump
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
| +0#0000e05#a8a8a8255@1>o+0#0000000#ffff4012|n|e|¶+0#4040ff13#ffffff0| +0#0000000&@53
|
||||||
|
|>@1|>+0#0000e05#5fd7ff255|-@6|t+0#0000000#ffff4012|a|b|¶+0#4040ff13#5fd7ff255| +0#0000000&@45
|
||||||
|
|>+0&#ffffff0@1| +0&#ffff4012@7|s|p|a|c|e|¶+0#4040ff13#5fd7ff255| +0#0000000&@43
|
||||||
|
|X+3&#ffffff0|b|u|f@1|e|r| |[|+|]| @30|1|,|1| @11|T|o|p
|
||||||
|
| +0&&@59
|
||||||
|
|~+0#4040ff13&| @58
|
||||||
|
|[+1#0000000&|N|o| |N|a|m|e|]| @32|0|,|0|-|1| @9|A|l@1
|
||||||
|
|:+0&&|s|e|t|l| |l|i|s|t| |l|i|s|t|c|h|a|r|s|=|e|o|l|:|¶|,|t|a|b|:|>|-| @26
|
||||||
@@ -3999,4 +3999,30 @@ func Test_overlong_textprop_above_crash()
|
|||||||
|
|
||||||
call StopVimInTerminal(buf)
|
call StopVimInTerminal(buf)
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func Test_text_prop_list_hl_and_sign_highlight()
|
||||||
|
CheckRunVimInTerminal
|
||||||
|
|
||||||
|
let lines =<< trim END
|
||||||
|
func Test()
|
||||||
|
split Xbuffer
|
||||||
|
call setline(1, ['one', "\ttab", ' space', 'three', 'four', 'five'])
|
||||||
|
call prop_type_add('Prop1', #{highlight: 'Search', override: v:true})
|
||||||
|
sign define sign1 text=>> linehl=DiffAdd
|
||||||
|
sign place 10 line=2 name=sign1
|
||||||
|
sign place 20 line=3 name=sign1
|
||||||
|
call prop_add(1, 1, #{end_lnum: 4, end_col: 5, type: 'Prop1'})
|
||||||
|
sign place 30 line=5 name=sign1
|
||||||
|
endfunc
|
||||||
|
call Test()
|
||||||
|
END
|
||||||
|
call writefile(lines, 'XtextPropSignTab', 'D')
|
||||||
|
let buf = RunVimInTerminal('-S XtextPropSignTab', #{rows: 8, cols: 60})
|
||||||
|
call VerifyScreenDump(buf, 'Test_prop_sign_tab_1', {})
|
||||||
|
|
||||||
|
call term_sendkeys(buf, ":setl list listchars=eol:¶,tab:>-\<CR>")
|
||||||
|
call VerifyScreenDump(buf, 'Test_prop_sign_tab_2', {})
|
||||||
|
|
||||||
|
call StopVimInTerminal(buf)
|
||||||
|
endfunc
|
||||||
" vim: shiftwidth=2 sts=2 expandtab
|
" vim: shiftwidth=2 sts=2 expandtab
|
||||||
|
|||||||
@@ -695,6 +695,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
1749,
|
||||||
/**/
|
/**/
|
||||||
1748,
|
1748,
|
||||||
/**/
|
/**/
|
||||||
|
|||||||
Reference in New Issue
Block a user