diff options
author | zeertzjq <zeertzjq@outlook.com> | 2024-03-18 10:35:41 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-18 10:35:41 +0800 |
commit | 9d315fb8b728355e8f1872f783b1ae9948e4fd9b (patch) | |
tree | d29bafc234075e6b7c7e451d9667fb8808c71f1d /src/nvim/grid.c | |
parent | eabf9de1dc8c8eeb8246491a0e389b5f9a5fde97 (diff) | |
download | rneovim-9d315fb8b728355e8f1872f783b1ae9948e4fd9b.tar.gz rneovim-9d315fb8b728355e8f1872f783b1ae9948e4fd9b.tar.bz2 rneovim-9d315fb8b728355e8f1872f783b1ae9948e4fd9b.zip |
vim-patch:9.1.0186: cursor pos wrong on mouse click after eol with 'rl', 've' and conceal (#27903)
Problem: Wrong cursor position when clicking after end of line with
'rightleft', 'virtualedit' and conceal.
Solution: Set values in ScreenCols[] also with SLF_RIGHTLEFT. Also fix
off-by-one cursor position with 'colorcolumn' (zeertzjq).
closes: vim/vim#14218
https://github.com/vim/vim/commit/deb2204bffa075ed5485415fc2dbd20e75d87ea4
Diffstat (limited to 'src/nvim/grid.c')
-rw-r--r-- | src/nvim/grid.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/nvim/grid.c b/src/nvim/grid.c index e911e6ad21..f51cdc478a 100644 --- a/src/nvim/grid.c +++ b/src/nvim/grid.c @@ -750,10 +750,15 @@ void grid_put_linebuf(ScreenGrid *grid, int row, int coloff, int col, int endcol } int clear_dirty_start = -1, clear_end = -1; + if (flags & SLF_RIGHTLEFT) { + for (col = clear_width - 1; col >= clear_start; col--) { + size_t off = off_to + (size_t)col; + grid->vcols[off] = (flags & SLF_INC_VCOL) ? ++last_vcol : last_vcol; + } + } // blank out the rest of the line // TODO(bfredl): we could cache winline widths - col = clear_start; - while (col < clear_width) { + for (col = clear_start; col < clear_width; col++) { size_t off = off_to + (size_t)col; if (grid->chars[off] != schar_from_ascii(' ') || grid->attrs[off] != bg_attr @@ -765,8 +770,9 @@ void grid_put_linebuf(ScreenGrid *grid, int row, int coloff, int col, int endcol } clear_end = col + 1; } - grid->vcols[off] = (flags & SLF_INC_VCOL) ? ++last_vcol : last_vcol; - col++; + if (!(flags & SLF_RIGHTLEFT)) { + grid->vcols[off] = (flags & SLF_INC_VCOL) ? ++last_vcol : last_vcol; + } } if ((flags & SLF_RIGHTLEFT) && start_dirty != -1 && clear_dirty_start != -1) { |