Skip to content

Commit 18d90b9

Browse files
committed
patch 8.0.0681: unnamed register only contains the last deleted text
Problem: Unnamed register only contains the last deleted text when appending deleted text to a register. (Wolfgang Jeltsch) Solution: Only set y_previous when not using y_append. (Christian Brabandt)
1 parent 07ecfa6 commit 18d90b9

3 files changed

Lines changed: 16 additions & 1 deletion

File tree

src/ops.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1636,7 +1636,9 @@ shift_delete_registers()
16361636
free_yank_all(); /* free register nine */
16371637
for (n = 9; n > 1; --n)
16381638
y_regs[n] = y_regs[n - 1];
1639-
y_previous = y_current = &y_regs[1];
1639+
y_current = &y_regs[1];
1640+
if (!y_append)
1641+
y_previous = y_current;
16401642
y_regs[1].y_array = NULL; /* set register one to empty */
16411643
}
16421644

src/testdir/test_put.vim

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,14 @@ func Test_put_char_block2()
3434
bw!
3535
call setreg('a', a[0], a[1])
3636
endfunc
37+
38+
func Test_put_lines()
39+
new
40+
let a = [ getreg('a'), getregtype('a') ]
41+
call setline(1, ['Line 1', 'Line2', 'Line 3', ''])
42+
exe 'norm! gg"add"AddG""p'
43+
call assert_equal(['Line 3', '', 'Line 1', 'Line2'], getline(1,'$'))
44+
" clean up
45+
bw!
46+
call setreg('a', a[0], a[1])
47+
endfunc

src/version.c

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

765765
static int included_patches[] =
766766
{ /* Add new patch number below this line */
767+
/**/
768+
681,
767769
/**/
768770
680,
769771
/**/

0 commit comments

Comments
 (0)