]> granicus.if.org Git - vim/commitdiff
patch 8.2.3455: using a count with "gp" leaves '] in wrong position v8.2.3455
authorBram Moolenaar <Bram@vim.org>
Wed, 22 Sep 2021 14:43:59 +0000 (16:43 +0200)
committerBram Moolenaar <Bram@vim.org>
Wed, 22 Sep 2021 14:43:59 +0000 (16:43 +0200)
Problem:    Using a count with "gp" leaves '] in wrong position. (Naohiro Ono)
Solution:   Correct the mark position. (closes #8899)

src/register.c
src/testdir/test_put.vim
src/version.c

index 3ddacb8ee4b9a38536ccff84b46fd30073001839..f034c645b02ce9eb915e9a12ab2180a04e689b55 100644 (file)
@@ -2205,6 +2205,9 @@ error:
                {
                    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)
index f03433628612c46e28300f4b9cb719410b8ff0ef..f3a320f463f5fe295ff85f2b6af0c0987556833f 100644 (file)
@@ -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
index fb36b14a1373a85a57b19dcaff756655516d2232..6865fa5c5b81cdf2f2dac4b3352dc85ad2154449 100644 (file)
@@ -757,6 +757,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    3455,
 /**/
     3454,
 /**/