neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

commit ab5a92bff67d654c543d89b4803a64b2e648253a
parent 922816877febf397fe854f01d8013a510d73f1d2
Author: zeertzjq <zeertzjq@outlook.com>
Date:   Sun, 28 Dec 2025 07:20:15 +0800

Merge pull request #37128 from zeertzjq/vim-9.1.2019

vim-patch:9.1.{2019,2026}
Diffstat:
Msrc/nvim/ops.c | 1+
Mtest/old/testdir/test_virtualedit.vim | 21+++++++++++++++++++++
2 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/src/nvim/ops.c b/src/nvim/ops.c @@ -1793,6 +1793,7 @@ void adjust_cursor_eol(void) const bool adj_cursor = (curwin->w_cursor.col > 0 && gchar_cursor() == NUL && (cur_ve_flags & kOptVeFlagOnemore) == 0 + && (cur_ve_flags & kOptVeFlagAll) == 0 && !(restart_edit || (State & MODE_INSERT))); if (!adj_cursor) { return; diff --git a/test/old/testdir/test_virtualedit.vim b/test/old/testdir/test_virtualedit.vim @@ -732,4 +732,25 @@ func Test_virtualedit_set_cursor_pos_maxcol() bwipe! endfunc +" Verify that getpos() remains consistent when the cursor is past EOL after +" toggling Visual mode with virtualedit=all. +func Test_virtualedit_getpos_stable_past_eol_after_visual() + new + set virtualedit=all + call setline(1, 'abc') + + normal! gg$3l + let p1 = getpos('.') + + normal! v + redraw + exe "normal! \<Esc>" + + let p2 = getpos('.') + call assert_equal(p1, p2, 'Position should not be re-encoded after leaving Visual mode') + + set virtualedit& + bwipe! +endfunc + " vim: shiftwidth=2 sts=2 expandtab