]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 8.2.4319: :put does not work properly in compiled function v8.2.4319
authorBram Moolenaar <Bram@vim.org>
Mon, 7 Feb 2022 15:31:37 +0000 (15:31 +0000)
committerBram Moolenaar <Bram@vim.org>
Mon, 7 Feb 2022 15:31:37 +0000 (15:31 +0000)
Problem:    :put does not work properly in compiled function. (John Beckett)
Solution:   Adjust the direction when using line zero.

src/testdir/test_vim9_cmd.vim
src/version.c
src/vim9execute.c

index 51a62e01f4879b5761a98d4890418dda71cb450e..0ac69e84fe827594be1f43f0870adf43d7099b22 100644 (file)
@@ -1156,7 +1156,13 @@ def Test_put_command()
   :2put =['a', 'b', 'c']
   assert_equal(['ppp', 'a', 'b', 'c', 'above'], getline(2, 6))
 
+  :0put ='first'
+  assert_equal('first', getline(1))
+  :1put! ='first again'
+  assert_equal('first again', getline(1))
+
   # compute range at runtime
+  :%del
   setline(1, range(1, 8))
   @a = 'aaa'
   :$-2put a
index f30ba25f5033285abec513e224e76a90ef7e64e8..3535adbeefcae607d943de66f0b72de1292c018a 100644 (file)
@@ -746,6 +746,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    4319,
 /**/
     4318,
 /**/
index 6c79ff7df316b280f60e26e8ff02e49c15cfd6d7..961e4507c52aece2a3fd4fb428ab408ac6ebccef 100644 (file)
@@ -4617,7 +4617,12 @@ exec_instructions(ectx_T *ectx)
                        // :put! above cursor
                        dir = BACKWARD;
                    else if (lnum >= 0)
-                       curwin->w_cursor.lnum = iptr->isn_arg.put.put_lnum;
+                   {
+                       curwin->w_cursor.lnum = lnum;
+                       if (lnum == 0)
+                           // check_cursor() below will move to line 1
+                           dir = BACKWARD;
+                   }
 
                    if (regname == '=')
                    {