vim-patch:9.1.0699: "dvgo" is not always an inclusive motion (#30173)

Problem:  "dvgo" is not always an inclusive motion
          (Iain King-Speir)
Solution: initialize the inclusive flag to false

fixes: vim/vim#15580
closes: vim/vim#15582

f8702aeb8f

Co-authored-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
zeertzjq 2024-08-29 06:24:40 +08:00 committed by GitHub
parent cd05a72fec
commit 0346666f71
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 19 additions and 5 deletions

View File

@ -355,11 +355,11 @@ gg Goto line [count], default first line, on the first
See also 'startofline' option.
:[range]go[to] [count] *:go* *:goto* *go*
[count]go Go to [count] byte in the buffer. Default [count] is
one, start of the file. When giving [range], the
last number in it used as the byte count. End-of-line
characters are counted depending on the current
'fileformat' setting.
[count]go Go to [count] byte in the buffer. |exclusive| motion.
Default [count] is one, start of the file. When
giving [range], the last number in it used as the byte
count. End-of-line characters are counted depending
on the current 'fileformat' setting.
Also see the |line2byte()| function, and the 'o'
option in 'statusline'.

View File

@ -5631,6 +5631,7 @@ static void nv_g_cmd(cmdarg_T *cap)
// "go": goto byte count from start of buffer
case 'o':
oap->inclusive = false;
goto_byte(cap->count0);
break;

View File

@ -4291,4 +4291,17 @@ func Test_scroll_longline_no_loop()
exe "normal! \<C-E>"
bwipe!
endfunc
" Test for go command
func Test_normal_go()
new
call setline(1, ['one two three four'])
call cursor(1, 5)
norm! dvgo
call assert_equal('wo three four', getline(1))
norm! ...
call assert_equal('three four', getline(1))
bwipe!
endfunc
" vim: shiftwidth=2 sts=2 expandtab nofoldenable