Skip to content
Snippets Groups Projects
Commit ac550fdb authored by Bram Moolenaar's avatar Bram Moolenaar
Browse files

Make 'cursorcolumn' work together with the conceal feature.

parent 0d2e4fce
No related branches found
No related tags found
No related merge requests found
...@@ -2780,6 +2780,10 @@ win_line(wp, lnum, startrow, endrow, nochange) ...@@ -2780,6 +2780,10 @@ win_line(wp, lnum, startrow, endrow, nochange)
int is_concealing = FALSE; int is_concealing = FALSE;
int boguscols = 0; /* nonexistent columns added to force int boguscols = 0; /* nonexistent columns added to force
wrapping */ wrapping */
int vcol_off = 0; /* offset for concealed characters */
# define VCOL_HLC (vcol - vcol_off)
#else
# define VCOL_HLC (vcol)
#endif #endif
if (startrow > endrow) /* past the end already! */ if (startrow > endrow) /* past the end already! */
...@@ -2818,7 +2822,7 @@ win_line(wp, lnum, startrow, endrow, nochange) ...@@ -2818,7 +2822,7 @@ win_line(wp, lnum, startrow, endrow, nochange)
/* Check for columns to display for 'colorcolumn'. */ /* Check for columns to display for 'colorcolumn'. */
color_cols = wp->w_p_cc_cols; color_cols = wp->w_p_cc_cols;
if (color_cols != NULL) if (color_cols != NULL)
draw_color_col = advance_color_col(vcol, &color_cols); draw_color_col = advance_color_col(VCOL_HLC, &color_cols);
#endif #endif
#ifdef FEAT_SPELL #ifdef FEAT_SPELL
...@@ -4393,10 +4397,8 @@ win_line(wp, lnum, startrow, endrow, nochange) ...@@ -4393,10 +4397,8 @@ win_line(wp, lnum, startrow, endrow, nochange)
first_conceal = FALSE; first_conceal = FALSE;
# ifdef FEAT_HLCOLUMN if (n_extra > 0)
if (hlc > 0 && n_extra > 0) vcol_off += n_extra;
hlc += n_extra;
# endif
vcol += n_extra; vcol += n_extra;
if (wp->w_p_wrap && n_extra > 0) if (wp->w_p_wrap && n_extra > 0)
{ {
...@@ -4535,7 +4537,7 @@ win_line(wp, lnum, startrow, endrow, nochange) ...@@ -4535,7 +4537,7 @@ win_line(wp, lnum, startrow, endrow, nochange)
++prevcol; ++prevcol;
#endif #endif
/* invert at least one char, used for Visual and empty line or /* Invert at least one char, used for Visual and empty line or
* highlight match at end of line. If it's beyond the last * highlight match at end of line. If it's beyond the last
* char on the screen, just overwrite that one (tricky!) Not * char on the screen, just overwrite that one (tricky!) Not
* needed when a '$' was displayed for 'list'. */ * needed when a '$' was displayed for 'list'. */
...@@ -4676,14 +4678,20 @@ win_line(wp, lnum, startrow, endrow, nochange) ...@@ -4676,14 +4678,20 @@ win_line(wp, lnum, startrow, endrow, nochange)
/* check if line ends before left margin */ /* check if line ends before left margin */
if (vcol < v + col - win_col_off(wp)) if (vcol < v + col - win_col_off(wp))
vcol = v + col - win_col_off(wp); vcol = v + col - win_col_off(wp);
#ifdef FEAT_CONCEAL
/* Get rid of the boguscols now, we want to draw until the right
* edge for 'cursorcolumn'. */
col -= boguscols;
boguscols = 0;
#endif
if (draw_color_col) if (draw_color_col)
draw_color_col = advance_color_col(vcol, &color_cols); draw_color_col = advance_color_col(VCOL_HLC, &color_cols);
if (((wp->w_p_cuc if (((wp->w_p_cuc
&& (int)wp->w_virtcol >= vcol - eol_hl_off && (int)wp->w_virtcol >= VCOL_HLC - eol_hl_off
&& (int)wp->w_virtcol < W_WIDTH(wp) * (row - startrow + 1) && (int)wp->w_virtcol <
+ v W_WIDTH(wp) * (row - startrow + 1) + v
&& lnum != wp->w_cursor.lnum) && lnum != wp->w_cursor.lnum)
|| draw_color_col) || draw_color_col)
# ifdef FEAT_RIGHTLEFT # ifdef FEAT_RIGHTLEFT
...@@ -4710,32 +4718,27 @@ win_line(wp, lnum, startrow, endrow, nochange) ...@@ -4710,32 +4718,27 @@ win_line(wp, lnum, startrow, endrow, nochange)
ScreenLinesUC[off] = 0; ScreenLinesUC[off] = 0;
#endif #endif
++col; ++col;
if (wp->w_p_cuc && vcol == (long)wp->w_virtcol) if (wp->w_p_cuc && VCOL_HLC == (long)wp->w_virtcol)
ScreenAttrs[off++] = hl_attr(HLF_CUC); ScreenAttrs[off++] = hl_attr(HLF_CUC);
else if (draw_color_col && vcol == *color_cols) else if (draw_color_col && VCOL_HLC == *color_cols)
ScreenAttrs[off++] = hl_attr(HLF_MC); ScreenAttrs[off++] = hl_attr(HLF_MC);
else else
ScreenAttrs[off++] = 0; ScreenAttrs[off++] = 0;
if (vcol >= rightmost_vcol) if (VCOL_HLC >= rightmost_vcol)
break; break;
if (draw_color_col) if (draw_color_col)
draw_color_col = advance_color_col(vcol, &color_cols); draw_color_col = advance_color_col(VCOL_HLC,
&color_cols);
++vcol; ++vcol;
} }
} }
#endif #endif
#ifdef FEAT_CONCEAL
SCREEN_LINE(screen_row, W_WINCOL(wp), col - boguscols,
(int)W_WIDTH(wp), wp->w_p_rl);
boguscols = 0;
#else
SCREEN_LINE(screen_row, W_WINCOL(wp), col, SCREEN_LINE(screen_row, W_WINCOL(wp), col,
(int)W_WIDTH(wp), wp->w_p_rl); (int)W_WIDTH(wp), wp->w_p_rl);
#endif
row++; row++;
/* /*
...@@ -4788,7 +4791,7 @@ win_line(wp, lnum, startrow, endrow, nochange) ...@@ -4788,7 +4791,7 @@ win_line(wp, lnum, startrow, endrow, nochange)
#ifdef FEAT_SYN_HL #ifdef FEAT_SYN_HL
/* advance to the next 'colorcolumn' */ /* advance to the next 'colorcolumn' */
if (draw_color_col) if (draw_color_col)
draw_color_col = advance_color_col(vcol, &color_cols); draw_color_col = advance_color_col(VCOL_HLC, &color_cols);
/* Highlight the cursor column if 'cursorcolumn' is set. But don't /* Highlight the cursor column if 'cursorcolumn' is set. But don't
* highlight the cursor position itself. * highlight the cursor position itself.
...@@ -4797,7 +4800,7 @@ win_line(wp, lnum, startrow, endrow, nochange) ...@@ -4797,7 +4800,7 @@ win_line(wp, lnum, startrow, endrow, nochange)
vcol_save_attr = -1; vcol_save_attr = -1;
if (draw_state == WL_LINE && !lnum_in_visual_area) if (draw_state == WL_LINE && !lnum_in_visual_area)
{ {
if (wp->w_p_cuc && vcol == (long)wp->w_virtcol if (wp->w_p_cuc && VCOL_HLC == (long)wp->w_virtcol
&& lnum != wp->w_cursor.lnum) && lnum != wp->w_cursor.lnum)
{ {
vcol_save_attr = char_attr; vcol_save_attr = char_attr;
...@@ -4906,17 +4909,12 @@ win_line(wp, lnum, startrow, endrow, nochange) ...@@ -4906,17 +4909,12 @@ win_line(wp, lnum, startrow, endrow, nochange)
} }
} }
#ifdef FEAT_CONCEAL #ifdef FEAT_CONCEAL
else if (wp->w_p_conceal && is_concealing) else if (wp->w_p_conceal > 0 && is_concealing)
{ {
--n_skip; --n_skip;
# ifdef FEAT_HLCOLUMN ++vcol_off;
if (hlc) if (n_extra > 0)
{ vcol_off += n_extra;
++hlc;
if (n_extra > 0)
hlc += n_extra;
}
# endif
if (wp->w_p_wrap) if (wp->w_p_wrap)
{ {
/* /*
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment