Skip to content

Commit

Permalink
patch 8.2.3455: using a count with "gp" leaves '] in wrong position
Browse files Browse the repository at this point in the history
Problem:    Using a count with "gp" leaves '] in wrong position. (Naohiro Ono)
Solution:   Correct the mark position. (closes #8899)
  • Loading branch information
brammool committed Sep 22, 2021
1 parent 23003e5 commit 56858e4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/register.c
Original file line number Diff line number Diff line change
Expand Up @@ -2205,6 +2205,9 @@ do_put(
{
curwin->w_cursor.lnum = new_lnum;
curwin->w_cursor.col = col;
curbuf->b_op_end = curwin->w_cursor;
if (col > 1)
curbuf->b_op_end.col = col - 1;
}
}
else if (y_type == MLINE)
Expand Down
6 changes: 4 additions & 2 deletions src/testdir/test_put.vim
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,10 @@ func Test_gp_with_count_leaves_cursor_at_end()
new
call setline(1, '<---->')
call setreg('@', "foo\nbar", 'c')
exe "normal 1G3|3gpix\<Esc>"
call assert_equal(['<--foo', 'barfoo', 'barfoo', 'barx-->'], getline(1, '$'))
normal 1G3|3gp
call assert_equal([0, 4, 4, 0], getpos("."))
call assert_equal(['<--foo', 'barfoo', 'barfoo', 'bar-->'], getline(1, '$'))
call assert_equal([0, 4, 3, 0], getpos("']"))

bwipe!
endfunc
Expand Down
2 changes: 2 additions & 0 deletions src/version.c
Original file line number Diff line number Diff line change
Expand Up @@ -757,6 +757,8 @@ static char *(features[]) =

static int included_patches[] =
{ /* Add new patch number below this line */
/**/
3455,
/**/
3454,
/**/
Expand Down

0 comments on commit 56858e4

Please sign in to comment.