Skip to content

Commit 56858e4

Browse files
committed
patch 8.2.3455: using a count with "gp" leaves '] in wrong position
Problem: Using a count with "gp" leaves '] in wrong position. (Naohiro Ono) Solution: Correct the mark position. (closes #8899)
1 parent 23003e5 commit 56858e4

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

src/register.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2205,6 +2205,9 @@ do_put(
22052205
{
22062206
curwin->w_cursor.lnum = new_lnum;
22072207
curwin->w_cursor.col = col;
2208+
curbuf->b_op_end = curwin->w_cursor;
2209+
if (col > 1)
2210+
curbuf->b_op_end.col = col - 1;
22082211
}
22092212
}
22102213
else if (y_type == MLINE)

src/testdir/test_put.vim

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,10 @@ func Test_gp_with_count_leaves_cursor_at_end()
126126
new
127127
call setline(1, '<---->')
128128
call setreg('@', "foo\nbar", 'c')
129-
exe "normal 1G3|3gpix\<Esc>"
130-
call assert_equal(['<--foo', 'barfoo', 'barfoo', 'barx-->'], getline(1, '$'))
129+
normal 1G3|3gp
130+
call assert_equal([0, 4, 4, 0], getpos("."))
131+
call assert_equal(['<--foo', 'barfoo', 'barfoo', 'bar-->'], getline(1, '$'))
132+
call assert_equal([0, 4, 3, 0], getpos("']"))
131133

132134
bwipe!
133135
endfunc

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -757,6 +757,8 @@ static char *(features[]) =
757757

758758
static int included_patches[] =
759759
{ /* Add new patch number below this line */
760+
/**/
761+
3455,
760762
/**/
761763
3454,
762764
/**/

0 commit comments

Comments
 (0)