0
0
mirror of https://github.com/vim/vim.git synced 2025-11-13 22:54:27 -05:00

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 <240319857+varsidry@users.noreply.github.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
varsidry
2025-10-31 16:16:11 +00:00
committed by Christian Brabandt
parent 958393b0b4
commit adc85151f3
4 changed files with 17 additions and 3 deletions

View 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>

View 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;
}
}

View 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

View File

@@ -729,6 +729,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
1891,
/**/
1890,
/**/