vim-patch:9.1.0174: 'cursorline' and 'wincolor' hl missing with conceal and wrap

Problem:  'cursorline' and 'wincolor' highlight missing with concealed and
          wrapped lines.
Solution: Apply 'cursorline' and 'wincolor' highlight to boguscols.
          (zeertzjq)

Since 'cursorline' and 'wincolor' highlight apply after the end of the
line, it is more consistent to have them also apply to boguscols.

Assigning MAXCOL to values in ScreenCols[] make mouse click behave the
same with 'cursorline' and 'nocursorline', but such behavior may be
incorrect, as it puts the cursor on the next screen line.  That may be
fixed in a future PR.

closes: vim/vim#14192

21b0a3df8c
This commit is contained in:
zeertzjq
2024-03-14 06:23:10 +08:00
parent b17be231a6
commit 9599e5d28d
3 changed files with 126 additions and 0 deletions

View File

@@ -2851,6 +2851,19 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, int col_rows, s
&& !wp->w_p_rl; // Not right-to-left.
int draw_col = wlv.col - wlv.boguscols;
// Apply 'cursorline' highlight.
if (wlv.boguscols != 0 && (wlv.line_attr_lowprio != 0 || wlv.line_attr != 0)) {
int attr = hl_combine_attr(wlv.line_attr_lowprio, wlv.line_attr);
while (draw_col < grid->cols) {
linebuf_char[wlv.off] = schar_from_char(' ');
linebuf_attr[wlv.off] = attr;
linebuf_vcol[wlv.off] = MAXCOL; // TODO(zeertzjq): this is wrong
wlv.off++;
draw_col++;
}
}
if (virt_line_offset >= 0) {
draw_virt_text_item(buf, virt_line_offset, kv_A(virt_lines, virt_line_index).line,
kHlModeReplace, grid->cols, 0);