changeset 14009:830a47e48791 v8.1.0022

patch 8.1.0022: repeating put from expression register fails commit https://github.com/vim/vim/commit/833093bfb0e4a7f89b5adc66babcfa8ac09cfda9 Author: Bram Moolenaar <Bram@vim.org> Date: Wed May 23 21:53:52 2018 +0200 patch 8.1.0022: repeating put from expression register fails Problem: Repeating put from expression register fails. Solution: Re-evaluate the expression register. (Andy Massimino, closes #2945)
author Christian Brabandt <cb@256bit.org>
date Wed, 23 May 2018 22:00:06 +0200
parents e773aacfc5bb
children 0a4514f40d19
files src/getchar.c src/testdir/test_put.vim src/version.c
diffstat 3 files changed, 23 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/getchar.c
+++ b/src/getchar.c
@@ -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);
     }
 
--- a/src/testdir/test_put.vim
+++ b/src/testdir/test_put.vim
@@ -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
--- a/src/version.c
+++ b/src/version.c
@@ -762,6 +762,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    22,
+/**/
     21,
 /**/
     20,