diff options
author | zeertzjq <zeertzjq@outlook.com> | 2024-03-14 06:44:41 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2024-03-14 06:55:10 +0800 |
commit | 2af1dc0116c1914684fa0c3d94032c2698a5230d (patch) | |
tree | aaece3caca346dc2a3aef7d15fafd6b289d1fe1d /src/nvim/drawline.c | |
parent | 9599e5d28d31cfb0cb16e878f123b74283cca26b (diff) | |
download | rneovim-2af1dc0116c1914684fa0c3d94032c2698a5230d.tar.gz rneovim-2af1dc0116c1914684fa0c3d94032c2698a5230d.tar.bz2 rneovim-2af1dc0116c1914684fa0c3d94032c2698a5230d.zip |
vim-patch:9.1.0176: Cursor column wrong with 'virtualedit' and conceal
Problem: Cursor column wrong with 'virtualedit' and conceal.
Solution: Correct cursor column at end of line if never reached.
(zeertzjq)
closes: vim/vim#14190
https://github.com/vim/vim/commit/253ff4dece4e6cc4a9ff3ed935bc78f832b6fb7c
Diffstat (limited to 'src/nvim/drawline.c')
-rw-r--r-- | src/nvim/drawline.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/nvim/drawline.c b/src/nvim/drawline.c index 8b8932be2d..8b6c3d58b2 100644 --- a/src/nvim/drawline.c +++ b/src/nvim/drawline.c @@ -2451,11 +2451,17 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, int col_rows, s // 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 && wp == curwin && lnum == wp->w_cursor.lnum && conceal_cursor_line(wp) - && (int)wp->w_virtcol <= wlv.vcol + wlv.skip_cells) { + && (wlv.vcol + wlv.skip_cells >= wp->w_virtcol || mb_schar == NUL)) { wp->w_wcol = wlv.col - wlv.boguscols; + if (wlv.vcol + wlv.skip_cells < wp->w_virtcol) { + // Cursor beyond end of the line with 'virtualedit'. + wp->w_wcol += wp->w_virtcol - wlv.vcol - wlv.skip_cells; + } wp->w_wrow = wlv.row; did_wcol = true; wp->w_valid |= VALID_WCOL|VALID_WROW|VALID_VIRTCOL; |