diff options
Diffstat (limited to 'src/nvim/drawline.c')
-rw-r--r-- | src/nvim/drawline.c | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/src/nvim/drawline.c b/src/nvim/drawline.c index e0887ed1d0..c2f0eb9e0e 100644 --- a/src/nvim/drawline.c +++ b/src/nvim/drawline.c @@ -165,12 +165,12 @@ void drawline_free_all_mem(void) /// Advance **color_cols /// /// @return true when there are columns to draw. -static bool advance_color_col(int vcol, int **color_cols) +static bool advance_color_col(int vcol, colorcol_T **color_cols) { - while (**color_cols >= 0 && vcol > **color_cols) { + while ((*color_cols)->col >= 0 && vcol > (*color_cols)->col) { (*color_cols)++; } - return **color_cols >= 0; + return (*color_cols)->col >= 0; } /// Used when 'cursorlineopt' contains "screenline": compute the margins between @@ -1025,7 +1025,7 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, bool number_onl int save_did_emsg; int eol_hl_off = 0; // 1 if highlighted char after EOL bool draw_color_col = false; // highlight colorcolumn - int *color_cols = NULL; // pointer to according columns array + colorcol_T *color_cols = NULL; // pointer to according columns array #define SPWORDLEN 150 char nextline[SPWORDLEN * 2]; // text with start of the next line int nextlinecol = 0; // column where nextline[] starts @@ -2665,15 +2665,14 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, bool number_onl if (draw_color_col) { // determine rightmost colorcolumn to possibly draw - for (int i = 0; color_cols[i] >= 0; i++) { - if (rightmost_vcol < color_cols[i]) { - rightmost_vcol = color_cols[i]; + for (int i = 0; color_cols[i].col >= 0; i++) { + if (rightmost_vcol < color_cols[i].col) { + rightmost_vcol = color_cols[i].col; } } } int cuc_attr = win_hl_attr(wp, HLF_CUC); - int mc_attr = win_hl_attr(wp, HLF_MC); int diff_attr = 0; if (wlv.diff_hlf == HLF_TXD) { @@ -2700,8 +2699,9 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, bool number_onl if (wp->w_p_cuc && VCOL_HLC == wp->w_virtcol) { col_attr = cuc_attr; - } else if (draw_color_col && VCOL_HLC == *color_cols) { - col_attr = hl_combine_attr(wlv.line_attr_lowprio, mc_attr); + } else if (draw_color_col && VCOL_HLC == color_cols->col) { + col_attr = color_cols->syn_attr; + linebuf_char[wlv.off] = schar_from_char(color_cols->ch); } col_attr = hl_combine_attr(col_attr, wlv.line_attr); @@ -2795,9 +2795,14 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, bool number_onl && lnum != wp->w_cursor.lnum) { vcol_save_attr = wlv.char_attr; wlv.char_attr = hl_combine_attr(win_hl_attr(wp, HLF_CUC), wlv.char_attr); - } else if (draw_color_col && VCOL_HLC == *color_cols) { + } else if (draw_color_col && VCOL_HLC == color_cols->col) { vcol_save_attr = wlv.char_attr; - wlv.char_attr = hl_combine_attr(win_hl_attr(wp, HLF_MC), wlv.char_attr); + + if (color_cols->flags & kColorcolForeground) { + wlv.char_attr = hl_combine_attr(wlv.char_attr, color_cols->syn_attr); + } else if (!(color_cols->flags & kColorcolBehind)) { + wlv.char_attr = hl_combine_attr(color_cols->syn_attr, wlv.char_attr); + } } } |