mirror of
https://github.com/vim/vim.git
synced 2025-07-26 11:04:33 -04:00
patch 9.0.1048: with "screenline" in 'culopt' cursorline highlight is wrong
Problem: With "screenline" in 'culopt' cursorline highlight is wrong. Solution: Apply the priority logic also when "screenline is in 'culopt'. (closes #11696)
This commit is contained in:
parent
7db29e4b5c
commit
b7acea1806
@ -985,6 +985,36 @@ win_line_continue(winlinevars_T *wlv)
|
|||||||
wlv->char_attr = wlv->win_attr;
|
wlv->char_attr = wlv->win_attr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef FEAT_SYN_HL
|
||||||
|
static void
|
||||||
|
apply_cursorline_highlight(
|
||||||
|
winlinevars_T *wlv,
|
||||||
|
int sign_present UNUSED)
|
||||||
|
{
|
||||||
|
wlv->cul_attr = HL_ATTR(HLF_CUL);
|
||||||
|
# ifdef FEAT_SIGNS
|
||||||
|
// Combine the 'cursorline' and sign highlighting, depending on
|
||||||
|
// the sign priority.
|
||||||
|
if (sign_present && wlv->sattr.sat_linehl > 0)
|
||||||
|
{
|
||||||
|
if (wlv->sattr.sat_priority >= 100)
|
||||||
|
wlv->line_attr = hl_combine_attr(wlv->cul_attr, wlv->line_attr);
|
||||||
|
else
|
||||||
|
wlv->line_attr = hl_combine_attr(wlv->line_attr, wlv->cul_attr);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
# endif
|
||||||
|
# if defined(FEAT_QUICKFIX)
|
||||||
|
// let the line attribute overrule 'cursorline', otherwise
|
||||||
|
// it disappears when both have background set;
|
||||||
|
// 'cursorline' can use underline or bold to make it show
|
||||||
|
wlv->line_attr = hl_combine_attr(wlv->cul_attr, wlv->line_attr);
|
||||||
|
# else
|
||||||
|
wlv->line_attr = wlv->cul_attr;
|
||||||
|
# endif
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Display line "lnum" of window 'wp' on the screen.
|
* Display line "lnum" of window 'wp' on the screen.
|
||||||
* Start at row "startrow", stop when "endrow" is reached.
|
* Start at row "startrow", stop when "endrow" is reached.
|
||||||
@ -1728,35 +1758,10 @@ win_line(
|
|||||||
wlv.cul_screenline = (wp->w_p_wrap
|
wlv.cul_screenline = (wp->w_p_wrap
|
||||||
&& (wp->w_p_culopt_flags & CULOPT_SCRLINE));
|
&& (wp->w_p_culopt_flags & CULOPT_SCRLINE));
|
||||||
|
|
||||||
// Only set wlv.line_attr here when "screenline" is not present in
|
// Only apply CursorLine highlight here when "screenline" is not
|
||||||
// 'cursorlineopt'. Otherwise it's done later.
|
// present in 'cursorlineopt'. Otherwise it's done later.
|
||||||
if (!wlv.cul_screenline)
|
if (!wlv.cul_screenline)
|
||||||
{
|
apply_cursorline_highlight(&wlv, sign_present);
|
||||||
wlv.cul_attr = HL_ATTR(HLF_CUL);
|
|
||||||
# ifdef FEAT_SIGNS
|
|
||||||
// Combine the 'cursorline' and sign highlighting, depending on
|
|
||||||
// the sign priority.
|
|
||||||
if (sign_present && wlv.sattr.sat_linehl > 0)
|
|
||||||
{
|
|
||||||
if (wlv.sattr.sat_priority >= 100)
|
|
||||||
wlv.line_attr = hl_combine_attr(
|
|
||||||
wlv.cul_attr, wlv.line_attr);
|
|
||||||
else
|
|
||||||
wlv.line_attr = hl_combine_attr(
|
|
||||||
wlv.line_attr, wlv.cul_attr);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
# endif
|
|
||||||
# if defined(FEAT_QUICKFIX)
|
|
||||||
// let the line attribute overrule 'cursorline', otherwise
|
|
||||||
// it disappears when both have background set;
|
|
||||||
// 'cursorline' can use underline or bold to make it show
|
|
||||||
wlv.line_attr = hl_combine_attr(
|
|
||||||
wlv.cul_attr, wlv.line_attr);
|
|
||||||
# else
|
|
||||||
wlv.line_attr = wlv.cul_attr;
|
|
||||||
# endif
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
line_attr_save = wlv.line_attr;
|
line_attr_save = wlv.line_attr;
|
||||||
@ -1850,8 +1855,7 @@ win_line(
|
|||||||
&& wlv.vcol >= left_curline_col
|
&& wlv.vcol >= left_curline_col
|
||||||
&& wlv.vcol < right_curline_col)
|
&& wlv.vcol < right_curline_col)
|
||||||
{
|
{
|
||||||
wlv.cul_attr = HL_ATTR(HLF_CUL);
|
apply_cursorline_highlight(&wlv, sign_present);
|
||||||
wlv.line_attr = wlv.cul_attr;
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -9,4 +9,4 @@
|
|||||||
|X+0#0000e05#ffffff0|C|w|i|n|d|o|w||+0#0000000&|4+0#af5f00255&| |c|o|l| |6|-|7||+0#0000000&| |m|a|t|c|h|e|s| @47
|
|X+0#0000e05#ffffff0|C|w|i|n|d|o|w||+0#0000000&|4+0#af5f00255&| |c|o|l| |6|-|7||+0#0000000&| |m|a|t|c|h|e|s| @47
|
||||||
|~+0#4040ff13&| @73
|
|~+0#4040ff13&| @73
|
||||||
|[+3#0000000&|Q|u|i|c|k|f|i|x| |L|i|s|t|]| |:|v|i|m|g|r|e|p| |e| |X|C|w|i|n|d|o|w| @20|2|,|1| @12|A|l@1
|
|[+3#0000000&|Q|u|i|c|k|f|i|x| |L|i|s|t|]| |:|v|i|m|g|r|e|p| |e| |X|C|w|i|n|d|o|w| @20|2|,|1| @12|A|l@1
|
||||||
|:+0&&|s|e|t| |c|u|r|s|o|r|l|i|n|e| @59
|
|:+0&&| @73
|
||||||
|
@ -9,4 +9,4 @@
|
|||||||
>X+8#0000e05#ffffff0|C|w|i|n|d|o|w||+8#0000000&|4+8#af5f00255&| |c|o|l| |6|-|7||+8#0000000&| |m|a|t|c|h|e|s| @47
|
>X+8#0000e05#ffffff0|C|w|i|n|d|o|w||+8#0000000&|4+8#af5f00255&| |c|o|l| |6|-|7||+8#0000000&| |m|a|t|c|h|e|s| @47
|
||||||
|~+0#4040ff13&| @73
|
|~+0#4040ff13&| @73
|
||||||
|[+3#0000000&|Q|u|i|c|k|f|i|x| |L|i|s|t|]| |:|v|i|m|g|r|e|p| |e| |X|C|w|i|n|d|o|w| @20|3|,|1| @12|A|l@1
|
|[+3#0000000&|Q|u|i|c|k|f|i|x| |L|i|s|t|]| |:|v|i|m|g|r|e|p| |e| |X|C|w|i|n|d|o|w| @20|3|,|1| @12|A|l@1
|
||||||
|:+0&&|s|e|t| |c|u|r|s|o|r|l|i|n|e| @59
|
|:+0&&| @73
|
||||||
|
@ -3120,6 +3120,11 @@ func Test_cwindow_highlight()
|
|||||||
call VerifyScreenDump(buf, 'Test_quickfix_cwindow_2', {})
|
call VerifyScreenDump(buf, 'Test_quickfix_cwindow_2', {})
|
||||||
|
|
||||||
call term_sendkeys(buf, "\<C-W>j:set cursorline\<CR>")
|
call term_sendkeys(buf, "\<C-W>j:set cursorline\<CR>")
|
||||||
|
call term_sendkeys(buf, ":\<CR>")
|
||||||
|
call VerifyScreenDump(buf, 'Test_quickfix_cwindow_3', {})
|
||||||
|
|
||||||
|
call term_sendkeys(buf, ":set cursorlineopt=number,screenline\<CR>")
|
||||||
|
call term_sendkeys(buf, ":\<CR>")
|
||||||
call VerifyScreenDump(buf, 'Test_quickfix_cwindow_3', {})
|
call VerifyScreenDump(buf, 'Test_quickfix_cwindow_3', {})
|
||||||
|
|
||||||
call term_sendkeys(buf, "j")
|
call term_sendkeys(buf, "j")
|
||||||
|
@ -1805,12 +1805,18 @@ func Test_sign_cursor_position()
|
|||||||
call term_sendkeys(buf, "2G")
|
call term_sendkeys(buf, "2G")
|
||||||
call term_sendkeys(buf, ":\<CR>")
|
call term_sendkeys(buf, ":\<CR>")
|
||||||
call VerifyScreenDump(buf, 'Test_sign_cursor_5', {})
|
call VerifyScreenDump(buf, 'Test_sign_cursor_5', {})
|
||||||
|
call term_sendkeys(buf, ":set cursorlineopt=number,screenline\<CR>")
|
||||||
|
call term_sendkeys(buf, ":\<CR>")
|
||||||
|
call VerifyScreenDump(buf, 'Test_sign_cursor_5', {})
|
||||||
|
|
||||||
" sign highlighting overrules 'cursorline'
|
" sign highlighting overrules 'cursorline'
|
||||||
call term_sendkeys(buf, ":sign unplace 12\<CR>")
|
call term_sendkeys(buf, ":sign unplace 12\<CR>")
|
||||||
call term_sendkeys(buf, ":sign place 13 line=2 priority=100 name=s2\<CR>")
|
call term_sendkeys(buf, ":sign place 13 line=2 priority=100 name=s2\<CR>")
|
||||||
call term_sendkeys(buf, ":\<CR>")
|
call term_sendkeys(buf, ":\<CR>")
|
||||||
call VerifyScreenDump(buf, 'Test_sign_cursor_6', {})
|
call VerifyScreenDump(buf, 'Test_sign_cursor_6', {})
|
||||||
|
call term_sendkeys(buf, ":set cursorlineopt&\<CR>")
|
||||||
|
call term_sendkeys(buf, ":\<CR>")
|
||||||
|
call VerifyScreenDump(buf, 'Test_sign_cursor_6', {})
|
||||||
|
|
||||||
" clean up
|
" clean up
|
||||||
call StopVimInTerminal(buf)
|
call StopVimInTerminal(buf)
|
||||||
|
@ -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 */
|
||||||
|
/**/
|
||||||
|
1048,
|
||||||
/**/
|
/**/
|
||||||
1047,
|
1047,
|
||||||
/**/
|
/**/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user