0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -04:00

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)
This commit is contained in:
Bram Moolenaar
2021-09-22 16:43:59 +02:00
parent 23003e51e1
commit 56858e4ed4
3 changed files with 9 additions and 2 deletions

View File

@@ -2205,6 +2205,9 @@ error:
{ {
curwin->w_cursor.lnum = new_lnum; curwin->w_cursor.lnum = new_lnum;
curwin->w_cursor.col = col; 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) else if (y_type == MLINE)

View File

@@ -126,8 +126,10 @@ func Test_gp_with_count_leaves_cursor_at_end()
new new
call setline(1, '<---->') call setline(1, '<---->')
call setreg('@', "foo\nbar", 'c') call setreg('@', "foo\nbar", 'c')
exe "normal 1G3|3gpix\<Esc>" normal 1G3|3gp
call assert_equal(['<--foo', 'barfoo', 'barfoo', 'barx-->'], getline(1, '$')) 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! bwipe!
endfunc endfunc

View File

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