aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2019-04-01 21:18:42 -0400
committerJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2019-04-01 21:29:59 -0400
commit8843928e10512b5ce17a99d896a16f03c12aeba1 (patch)
tree87caae4fd14bbb23c52fac8c022ff95d9f802a15 /src
parent35362495c965554f45634bcde3c4ce6d5eca52aa (diff)
downloadrneovim-8843928e10512b5ce17a99d896a16f03c12aeba1.tar.gz
rneovim-8843928e10512b5ce17a99d896a16f03c12aeba1.tar.bz2
rneovim-8843928e10512b5ce17a99d896a16f03c12aeba1.zip
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) https://github.com/vim/vim/commit/18d90b95c49d9ff1c635dd762864022aab8e71f1
Diffstat (limited to 'src')
-rw-r--r--src/nvim/ops.c4
-rw-r--r--src/nvim/testdir/test_put.vim11
2 files changed, 14 insertions, 1 deletions
diff --git a/src/nvim/ops.c b/src/nvim/ops.c
index 02ec3aad31..f4db97670e 100644
--- a/src/nvim/ops.c
+++ b/src/nvim/ops.c
@@ -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);
diff --git a/src/nvim/testdir/test_put.vim b/src/nvim/testdir/test_put.vim
index 0b8961c52b..b95406c5a7 100644
--- a/src/nvim/testdir/test_put.vim
+++ b/src/nvim/testdir/test_put.vim
@@ -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