Skip to content

Commit 833093b

Browse files
committed
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)
1 parent d315cf5 commit 833093b

File tree

3 files changed

+23
-0
lines changed

3 files changed

+23
-0
lines changed

src/getchar.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -844,6 +844,14 @@ start_redo(long count, int old_redo)
844844
if (c >= '1' && c < '9')
845845
++c;
846846
add_char_buff(&readbuf2, c);
847+
848+
/* the expression register should be re-evaluated */
849+
if (c == '=')
850+
{
851+
add_char_buff(&readbuf2, CAR);
852+
cmd_silent = TRUE;
853+
}
854+
847855
c = read_redo(FALSE, old_redo);
848856
}
849857

src/testdir/test_put.vim

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,16 @@ func Test_put_lines()
4545
bw!
4646
call setreg('a', a[0], a[1])
4747
endfunc
48+
49+
func Test_put_expr()
50+
new
51+
call setline(1, repeat(['A'], 6))
52+
exec "1norm! \"=line('.')\<cr>p"
53+
norm! j0.
54+
norm! j0.
55+
exec "4norm! \"=\<cr>P"
56+
norm! j0.
57+
norm! j0.
58+
call assert_equal(['A1','A2','A3','4A','5A','6A'], getline(1,'$'))
59+
bw!
60+
endfunc

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -761,6 +761,8 @@ static char *(features[]) =
761761

762762
static int included_patches[] =
763763
{ /* Add new patch number below this line */
764+
/**/
765+
22,
764766
/**/
765767
21,
766768
/**/

0 commit comments

Comments
 (0)