diff options
author | zeertzjq <zeertzjq@outlook.com> | 2024-03-13 20:38:26 +0100 |
---|---|---|
committer | Christian Brabandt <cb@256bit.org> | 2024-03-13 20:38:26 +0100 |
commit | 253ff4dece4e6cc4a9ff3ed935bc78f832b6fb7c (patch) | |
tree | f30426095c5bd9e5f18442a8d2ec37051d79f8c3 /src/drawline.c | |
parent | 5866bc3a0f54115d5982fdc09bdbe4c45069265a (diff) |
patch 9.1.0176: Cursor column wrong with 'virtualedit' and concealv9.1.0176
Problem: Cursor column wrong with 'virtualedit' and conceal.
Solution: Correct cursor column at end of line if never reached.
(zeertzjq)
closes: #14190
Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Diffstat (limited to 'src/drawline.c')
-rw-r--r-- | src/drawline.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/drawline.c b/src/drawline.c index 946e9bd3dd..088477faf0 100644 --- a/src/drawline.c +++ b/src/drawline.c @@ -3547,10 +3547,12 @@ win_line( #ifdef FEAT_CONCEAL // In the cursor line and we may be concealing characters: correct // the cursor column when we reach its position. + // With 'virtualedit' we may never reach cursor position, but we still + // need to correct the cursor column, so do that at end of line. if (!did_wcol && wlv.draw_state == WL_LINE && wp == curwin && lnum == wp->w_cursor.lnum && conceal_cursor_line(wp) - && (int)wp->w_virtcol <= wlv.vcol + skip_cells) + && (wlv.vcol + skip_cells >= wp->w_virtcol || c == NUL)) { # ifdef FEAT_RIGHTLEFT if (wp->w_p_rl) @@ -3558,6 +3560,9 @@ win_line( else # endif wp->w_wcol = wlv.col - wlv.boguscols; + if (wlv.vcol + skip_cells < wp->w_virtcol) + // Cursor beyond end of the line with 'virtualedit'. + wp->w_wcol += wp->w_virtcol - wlv.vcol - skip_cells; wp->w_wrow = wlv.row; did_wcol = TRUE; curwin->w_valid |= VALID_WCOL|VALID_WROW|VALID_VIRTCOL; |