vim-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)
18d90b95c4
This commit is contained in:
Jan Edmund Lazo 2019-04-01 21:18:42 -04:00
parent 35362495c9
commit 8843928e10
2 changed files with 14 additions and 1 deletions

View File

@ -1408,7 +1408,9 @@ int op_delete(oparg_T *oap)
free_register(&y_regs[9]); /* free register "9 */
for (n = 9; n > 1; n--)
y_regs[n] = y_regs[n - 1];
y_previous = &y_regs[1];
if (!is_append_register(oap->regname)) {
y_previous = &y_regs[1];
}
y_regs[1].y_array = NULL; /* set register "1 to empty */
reg = &y_regs[1];
op_yank_reg(oap, false, reg, false);

View File

@ -47,3 +47,14 @@ func Test_put_expr()
call assert_equal(['A1','A2','A3','4A','5A','6A'], getline(1,'$'))
bw!
endfunc
func Test_put_lines()
new
let a = [ getreg('a'), getregtype('a') ]
call setline(1, ['Line 1', 'Line2', 'Line 3', ''])
exe 'norm! gg"add"AddG""p'
call assert_equal(['Line 3', '', 'Line 1', 'Line2'], getline(1,'$'))
" clean up
bw!
call setreg('a', a[0], a[1])
endfunc