Skip to content

Commit

Permalink
dvgo is not always an inclusive motion
Browse files Browse the repository at this point in the history
Problem:  "dvgo" is not always an inclusive motion
Solution: initialize oap->inclusive to FALSE always

fixes: vim#15580

Signed-off-by: Christian Brabandt <[email protected]>
  • Loading branch information
chrisbra committed Aug 28, 2024
1 parent 39eff4c commit cab5ca5
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
12 changes: 6 additions & 6 deletions runtime/doc/motion.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
*motion.txt* For Vim version 9.1. Last change: 2024 Jul 14
*motion.txt* For Vim version 9.1. Last change: 2024 Aug 28


VIM REFERENCE MANUAL by Bram Moolenaar
Expand Down Expand Up @@ -364,11 +364,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'.
{not available when compiled without the
Expand Down
1 change: 1 addition & 0 deletions src/normal.c
Original file line number Diff line number Diff line change
Expand Up @@ -6227,6 +6227,7 @@ nv_g_cmd(cmdarg_T *cap)
#ifdef FEAT_BYTEOFF
// "go": goto byte count from start of buffer
case 'o':
oap->inclusive = FALSE;
goto_byte(cap->count0);
break;
#endif
Expand Down
13 changes: 13 additions & 0 deletions src/testdir/test_normal.vim
Original file line number Diff line number Diff line change
Expand Up @@ -4281,4 +4281,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

0 comments on commit cab5ca5

Please sign in to comment.