]> granicus.if.org Git - vim/commitdiff
patch 8.1.0022: repeating put from expression register fails v8.1.0022
authorBram Moolenaar <Bram@vim.org>
Wed, 23 May 2018 19:53:52 +0000 (21:53 +0200)
committerBram Moolenaar <Bram@vim.org>
Wed, 23 May 2018 19:53:52 +0000 (21:53 +0200)
Problem:    Repeating put from expression register fails.
Solution:   Re-evaluate the expression register. (Andy Massimino,
            closes #2945)

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

index ddb23dd5c1465981db34f7586365b209ea4ae263..ff03905b442417f98388a7bca078630a3b7ae0e1 100644 (file)
@@ -844,6 +844,14 @@ start_redo(long count, int old_redo)
        if (c >= '1' && c < '9')
            ++c;
        add_char_buff(&readbuf2, c);
+
+       /* the expression register should be re-evaluated */
+       if (c == '=')
+       {
+           add_char_buff(&readbuf2, CAR);
+           cmd_silent = TRUE;
+       }
+
        c = read_redo(FALSE, old_redo);
     }
 
index 18c7f4e64d428cbe2880f8c2a8d1d7daa1672a45..0a23a43919026d65e742ceed0593136fad4eedd6 100644 (file)
@@ -45,3 +45,16 @@ func Test_put_lines()
   bw!
   call setreg('a', a[0], a[1])
 endfunc
+
+func Test_put_expr()
+  new
+  call setline(1, repeat(['A'], 6))
+  exec "1norm! \"=line('.')\<cr>p"
+  norm! j0.
+  norm! j0.
+  exec "4norm! \"=\<cr>P"
+  norm! j0.
+  norm! j0.
+  call assert_equal(['A1','A2','A3','4A','5A','6A'], getline(1,'$'))
+  bw!
+endfunc
index 3208eca446af02ddb9557af3f64918687beac7b8..0cfe61a04a306e09158cfae04e2656b1035bba17 100644 (file)
@@ -761,6 +761,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    22,
 /**/
     21,
 /**/