summaryrefslogtreecommitdiffstats
path: root/src/drawline.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2021-11-24 16:20:13 +0000
committerBram Moolenaar <Bram@vim.org>2021-11-24 16:20:13 +0000
commite413ea04b716effb28eb49dbc98ad3f9f761545a (patch)
tree64c13d8b06ffb929eae3f814805077e93ecf7ecc /src/drawline.c
parent1f2453fec6f8f0f315f00ca7b562a02090cb1e37 (diff)
patch 8.2.3664: cannot adjust sign highlighting for 'cursorline'v8.2.3664
Problem: Cannot adjust sign highlighting for 'cursorline'. Solution: Add CursorLineSign and CursorLineFold highlight groups. (Gregory Anders, closes #9201)
Diffstat (limited to 'src/drawline.c')
-rw-r--r--src/drawline.c31
1 files changed, 27 insertions, 4 deletions
diff --git a/src/drawline.c b/src/drawline.c
index 7d6f669ba1..e68a602858 100644
--- a/src/drawline.c
+++ b/src/drawline.c
@@ -77,6 +77,17 @@ margin_columns_win(win_T *wp, int *left_col, int *right_col)
#ifdef FEAT_SIGNS
/*
+ * Return TRUE if CursorLineSign highlight is to be used.
+ */
+ static int
+use_cursor_line_sign(win_T *wp, linenr_T lnum)
+{
+ return wp->w_p_cul
+ && lnum == wp->w_cursor.lnum
+ && (wp->w_p_culopt_flags & CULOPT_NBR);
+}
+
+/*
* Get information needed to display the sign in line 'lnum' in window 'wp'.
* If 'nrcol' is TRUE, the sign is going to be displayed in the number column.
* Otherwise the sign is going to be displayed in the sign column.
@@ -85,7 +96,7 @@ margin_columns_win(win_T *wp, int *left_col, int *right_col)
get_sign_display_info(
int nrcol,
win_T *wp,
- linenr_T lnum UNUSED,
+ linenr_T lnum,
sign_attrs_T *sattr,
int wcr_attr,
int row,
@@ -111,7 +122,10 @@ get_sign_display_info(
*n_extrap = number_width(wp) + 1;
else
{
- *char_attrp = hl_combine_attr(wcr_attr, HL_ATTR(HLF_SC));
+ if (use_cursor_line_sign(wp, lnum))
+ *char_attrp = hl_combine_attr(wcr_attr, HL_ATTR(HLF_CLS));
+ else
+ *char_attrp = hl_combine_attr(wcr_attr, HL_ATTR(HLF_SC));
*n_extrap = 2;
}
@@ -176,7 +190,11 @@ get_sign_display_info(
*c_finalp = NUL;
*n_extrap = (int)STRLEN(*pp_extra);
}
- *char_attrp = sattr->sat_texthl;
+
+ if (use_cursor_line_sign(wp, lnum) && sattr->sat_culhl > 0)
+ *char_attrp = sattr->sat_culhl;
+ else
+ *char_attrp = sattr->sat_texthl;
}
}
}
@@ -1051,7 +1069,12 @@ win_line(
p_extra = p_extra_free;
c_extra = NUL;
c_final = NUL;
- char_attr = hl_combine_attr(wcr_attr, HL_ATTR(HLF_FC));
+ if (use_cursor_line_sign(wp, lnum))
+ char_attr =
+ hl_combine_attr(wcr_attr, HL_ATTR(HLF_CLF));
+ else
+ char_attr =
+ hl_combine_attr(wcr_attr, HL_ATTR(HLF_FC));
}
}
}