summaryrefslogtreecommitdiffstats
path: root/src/drawline.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-12-12 13:20:43 +0000
committerBram Moolenaar <Bram@vim.org>2022-12-12 13:20:43 +0000
commitb7acea1806996a9afb9fb8ebfe571b5181063070 (patch)
tree5fe7f3f28b0167ef6072abd6280f2ce7bf9b67b9 /src/drawline.c
parent7db29e4b5c3a347d24ca5062ddaa5cf4c4d54b9c (diff)
patch 9.0.1048: with "screenline" in 'culopt' cursorline highlight is wrongv9.0.1048
Problem: With "screenline" in 'culopt' cursorline highlight is wrong. Solution: Apply the priority logic also when "screenline is in 'culopt'. (closes #11696)
Diffstat (limited to 'src/drawline.c')
-rw-r--r--src/drawline.c64
1 files changed, 34 insertions, 30 deletions
diff --git a/src/drawline.c b/src/drawline.c
index 804b1005af..0e090f42d1 100644
--- a/src/drawline.c
+++ b/src/drawline.c
@@ -985,6 +985,36 @@ win_line_continue(winlinevars_T *wlv)
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.
* Start at row "startrow", stop when "endrow" is reached.
@@ -1728,35 +1758,10 @@ win_line(
wlv.cul_screenline = (wp->w_p_wrap
&& (wp->w_p_culopt_flags & CULOPT_SCRLINE));
- // Only set wlv.line_attr here when "screenline" is not present in
- // 'cursorlineopt'. Otherwise it's done later.
+ // Only apply CursorLine highlight here when "screenline" is not
+ // present in 'cursorlineopt'. Otherwise it's done later.
if (!wlv.cul_screenline)
- {
- 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
- }
+ apply_cursorline_highlight(&wlv, sign_present);
else
{
line_attr_save = wlv.line_attr;
@@ -1850,8 +1855,7 @@ win_line(
&& wlv.vcol >= left_curline_col
&& wlv.vcol < right_curline_col)
{
- wlv.cul_attr = HL_ATTR(HLF_CUL);
- wlv.line_attr = wlv.cul_attr;
+ apply_cursorline_highlight(&wlv, sign_present);
}
#endif