]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.1.1891: g<End> does not move to last non-blank in visual mode v9.1.1891
authorvarsidry <240319857+varsidry@users.noreply.github.com>
Fri, 31 Oct 2025 16:16:11 +0000 (16:16 +0000)
committerChristian Brabandt <cb@256bit.org>
Fri, 31 Oct 2025 16:16:11 +0000 (16:16 +0000)
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 <240319857+varsidry@users.noreply.github.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
runtime/doc/index.txt
src/normal.c
src/testdir/test_normal.vim
src/version.c

index 2966a6303f7cb6f91705aa70389d28b4b76fba81..0581a836994dd10c9e5d4204e65f6a550bc3a125 100644 (file)
@@ -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>
index 63edaa964cff41d86144fe05388d6a1f5bccc2c2..0f336a276d66a9fea20fe59bfe186417d6f26852 100644 (file)
@@ -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;
     }
 }
index 374696443d0b3c881bfa2aeef9ebf9e55241ecfa..58c1b97832ee19fa9c5eafe34b629e2b056d8751 100644 (file)
@@ -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
 
index 5af88e6115c5b3c08f05f6e597397a959f329d40..df3adb3bb205a4dd741ca8a11d8d771443a247ba 100644 (file)
@@ -729,6 +729,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1891,
 /**/
     1890,
 /**/