patch 9.1.1891: g<End> does not move to last non-blank in visual mode
Commit: https://github.com/vim/vim/commit/adc85151f3c6a6cea4bb8c8da3465429fc120445 Author: varsidry <[email protected]> Date: Fri Oct 31 16:16:11 2025 +0000 patch 9.1.1891: g<End> does not move to last non-blank in visual mode Problem: In visual mode, g<End> does not move to the last non-blank character when the end of a line is on the same line as the cursor (after v9.0.1753) Solution: Move the cursor back by one position if it lands after the line (varsidry) fixes: #18657 closes: #18658 Signed-off-by: varsidry <[email protected]> Signed-off-by: Christian Brabandt <[email protected]> diff --git a/runtime/doc/index.txt b/runtime/doc/index.txt index 2966a6303..0581a8369 100644 --- a/runtime/doc/index.txt +++ b/runtime/doc/index.txt @@ -1,4 +1,4 @@ -*index.txt* For Vim version 9.1. Last change: 2025 Aug 06 +*index.txt* For Vim version 9.1. Last change: 2025 Oct 31 VIM REFERENCE MANUAL by Bram Moolenaar @@ -807,7 +807,8 @@ tag char note action in Normal mode ~ |g@| g@{motion} call 'operatorfunc' |g~| g~{motion} 2 swap case for Nmove text |g<Down>| g<Down> 1 same as "gj" -|g<End>| g<End> 1 same as "g$" +|g<End>| g<End> 1 same as "g$" but go to the rightmost + non-blank character instead |g<Home>| g<Home> 1 same as "g0" |g<LeftMouse>| g<LeftMouse> same as <C-LeftMouse> g<MiddleMouse> same as <C-MiddleMouse> diff --git a/src/normal.c b/src/normal.c index 63edaa964..0f336a276 100644 --- a/src/normal.c +++ b/src/normal.c @@ -5936,7 +5936,7 @@ nv_g_dollar_cmd(cmdarg_T *cap) { do i = gchar_cursor(); - while (VIM_ISWHITE(i) && oneleft() == OK); + while (IS_WHITE_OR_NUL(i) && oneleft() == OK); curwin->w_valid &= ~VALID_WCOL; } } diff --git a/src/testdir/test_normal.vim b/src/testdir/test_normal.vim index 374696443..58c1b9783 100644 --- a/src/testdir/test_normal.vim +++ b/src/testdir/test_normal.vim @@ -4195,6 +4195,17 @@ func Test_normal33_g_cmd_nonblank() call assert_equal(20, col('.')) exe "normal 0g\<kEnd>" call assert_equal(11, col('.')) + + " Test visual mode at end of line + normal 0$bvg$y + call assert_equal(80, col("'>")) + exe "normal 0$bvg\<End>y" + call assert_equal(71, col("'>")) + setlocal nowrap virtualedit=all + exe "normal 0$\<C-v>llg\<End>y" + call assert_equal(71, col("'<")) + exe "normal 0$llvg\<End>y" + call assert_equal(71, col("'<")) bw! endfunc diff --git a/src/version.c b/src/version.c index 5af88e611..df3adb3bb 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 */ +/**/ + 1891, /**/ 1890, /**/ -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion visit https://groups.google.com/d/msgid/vim_dev/E1vEsFP-00EKYD-AE%40256bit.org.
