diff options
author | zeertzjq <zeertzjq@outlook.com> | 2024-03-15 05:54:22 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-15 05:54:22 +0800 |
commit | ca7dd33fa783181d62b0573082d2e691fcfc29d2 (patch) | |
tree | f07c323c36cd22d522806a3ea1052f84aff66c59 /src/nvim/drawline.c | |
parent | 4de4f13eb35e40799198689a5ae0bc534b4e38a8 (diff) | |
download | rneovim-ca7dd33fa783181d62b0573082d2e691fcfc29d2.tar.gz rneovim-ca7dd33fa783181d62b0573082d2e691fcfc29d2.tar.bz2 rneovim-ca7dd33fa783181d62b0573082d2e691fcfc29d2.zip |
fix(highlight): don't show CursorColumn on current line (#27848)
Problem:
CursorColumn highlight behavior is inconsistent with 'virtualedit' set:
- If cursor is on the text, CursorColumn is not shown.
- If cursor is after end of line, CursorColumn is shown.
Solution:
Don't shown CursorColumn on current line if cursor is after end of line.
Vim doesn't have this problem because in most cases it uses the code
path for drawing buffer text when CursorColumn highlight is needed.
Diffstat (limited to 'src/nvim/drawline.c')
-rw-r--r-- | src/nvim/drawline.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/nvim/drawline.c b/src/nvim/drawline.c index 851ed55f6e..2f541a8a21 100644 --- a/src/nvim/drawline.c +++ b/src/nvim/drawline.c @@ -2594,10 +2594,11 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, int col_rows, s int col_attr = base_attr; - if (wp->w_p_cuc && vcol_hlc(wlv) == wp->w_virtcol) { - col_attr = cuc_attr; + if (wp->w_p_cuc && vcol_hlc(wlv) == wp->w_virtcol + && lnum != wp->w_cursor.lnum) { + col_attr = hl_combine_attr(col_attr, cuc_attr); } else if (wlv.color_cols && vcol_hlc(wlv) == *wlv.color_cols) { - col_attr = hl_combine_attr(wlv.line_attr_lowprio, mc_attr); + col_attr = hl_combine_attr(col_attr, mc_attr); } col_attr = hl_combine_attr(col_attr, wlv.line_attr); @@ -2798,7 +2799,7 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, int col_rows, s wlv.char_attr = vcol_save_attr; } - // restore attributes after "predeces" in 'listchars' + // restore attributes after "precedes" in 'listchars' if (n_attr3 > 0 && --n_attr3 == 0) { wlv.char_attr = saved_attr3; } |