From: phanium <91544758+phanen@users.noreply.github.com> Date: Thu, 11 Dec 2025 19:39:27 +0000 (+0100) Subject: patch 9.1.1970: visual end column returns wrong value after block edit X-Git-Tag: v9.1.1970^0 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=fa3bdc2501faeae7f3211fc8559ded43e27b864c;p=thirdparty%2Fvim.git patch 9.1.1970: visual end column returns wrong value after block edit Problem: visual end column returns wrong value after block edit Solution: update visual end column after block insert (phanium) fixes: #18900 closes: #18903 Co-authored-by: zeertzjq Signed-off-by: phanium <91544758+phanen@users.noreply.github.com> Signed-off-by: Christian Brabandt --- diff --git a/src/ops.c b/src/ops.c index 1544f34d47..7e1bb1bfb4 100644 --- a/src/ops.c +++ b/src/ops.c @@ -754,6 +754,11 @@ block_insert( // the insert in the first line. curbuf->b_op_end.lnum = oap->end.lnum; curbuf->b_op_end.col = offset; + if (curbuf->b_visual.vi_end.coladd) + { + curbuf->b_visual.vi_end.col += curbuf->b_visual.vi_end.coladd; + curbuf->b_visual.vi_end.coladd = 0; + } } } // for all lnum diff --git a/src/testdir/test_visual.vim b/src/testdir/test_visual.vim index 4fab925463..557271a06c 100644 --- a/src/testdir/test_visual.vim +++ b/src/testdir/test_visual.vim @@ -2822,4 +2822,17 @@ func Test_visual_pos_buffer_heap_overflow() bw! Xa Xb endfunc +" Test visual block pos update after block insert and gv +func Test_visual_block_pos_update() + new + set virtualedit=block + call setline(1, ['aacccc', 'bb']) + exe "norm! e\jAa\gv" + call assert_equal([[0, 1, 6, 0], [0 , 2, 6, 0]], [getpos("v"), getpos(".")]) + normal! kj + call assert_equal([[0, 1, 6, 0], [0 , 2, 6, 0]], [getpos("v"), getpos(".")]) + set virtualedit= + bw! +endfunc + " vim: shiftwidth=2 sts=2 expandtab diff --git a/src/version.c b/src/version.c index 6b6dde51eb..2e806c33c1 100644 --- a/src/version.c +++ b/src/version.c @@ -729,6 +729,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1970, /**/ 1969, /**/