]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.0.1761: g<kEnd> behaves different from g<end> v9.0.1761
authorzeertzjq <zeertzjq@outlook.com>
Sun, 20 Aug 2023 16:24:20 +0000 (18:24 +0200)
committerChristian Brabandt <cb@256bit.org>
Sun, 20 Aug 2023 16:24:20 +0000 (18:24 +0200)
Problem:  g<kEnd> behaves different from g<end>
Solution: Make g<kEnd> behave like g<End>

closes: #12861

Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
runtime/doc/motion.txt
src/normal.c
src/testdir/test_normal.vim
src/version.c

index 46f968045a6343763af5804e2c7438e9d6f06212..2ddd1b9cec5539cdc5295ed0a859ee185810aa5f 100644 (file)
@@ -255,7 +255,8 @@ g$                  When lines wrap ('wrap' on): To the last character of
                        instead of going to the end of the line.
                        When 'virtualedit' is enabled moves to the end of the
                        screen line.
-                                                       *g<End>*
+
+                                                       *g<End>* *g<kEnd>*
 g<End>                 Like |g$| but to the last non-blank character
                        instead of the last character.
 
index cbcfd746def78202400f0e665099d18b3d2cdb13..38229e96e5e79640685fa546a7c90e28f36abbac 100644 (file)
@@ -5823,7 +5823,7 @@ nv_g_dollar_cmd(cmdarg_T *cap)
     int                col_off = curwin_col_off();
     int                flag = FALSE;
 
-    if (cap->nchar == K_END)
+    if (cap->nchar == K_END || cap->nchar == K_KEND)
        flag = TRUE;
 
     oap->motion_type = MCHAR;
index 92d1134d7e29d8342f5494e065cf8bef56a18a50..efda142d1da0c123ff6ba7a70f2083a761c9128f 100644 (file)
@@ -4105,20 +4105,24 @@ func Test_normal_click_on_double_width_char()
 endfunc
 
 func Test_normal33_g_cmd_nonblank()
-  " Test that g$ goes to the last non-blank char and g<end> to the last
+  " Test that g<End> goes to the last non-blank char and g$ to the last
   " visible column
   20vnew
   setlocal nowrap nonumber signcolumn=no
   call setline(1, ['fooo   fooo         fooo   fooo         fooo   fooo         fooo   fooo        '])
-  exe "normal 0g\<end>"
+  exe "normal 0g\<End>"
   call assert_equal(11, col('.'))
   normal 0g$
   call assert_equal(20, col('.'))
+  exe "normal 0g\<kEnd>"
+  call assert_equal(11, col('.'))
   setlocal wrap
-  exe "normal 0g\<end>"
+  exe "normal 0g\<End>"
   call assert_equal(11, col('.'))
   normal 0g$
   call assert_equal(20, col('.'))
+  exe "normal 0g\<kEnd>"
+  call assert_equal(11, col('.'))
   bw!
 endfunc
 
index 93192c3236477bb13ea1f67b583e3a99a62edd84..19509d1ddfde098165a1f26d98da77d3d970e9c3 100644 (file)
@@ -695,6 +695,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1761,
 /**/
     1760,
 /**/