diff src/testdir/test_registers.vim @ 29473:1c688281673d v9.0.0078

patch 9.0.0078: star register is unexpectedly changed when deleting Commit: https://github.com/vim/vim/commit/559f230fd618e51d7986d87217ff38a2eac73cef Author: Ernie Rael <errael@raelity.com> Date: Tue Jul 26 14:44:36 2022 +0100 patch 9.0.0078: star register is unexpectedly changed when deleting Problem: Star register is changed when deleting and both "unnamed" and "unnamedplus" are in 'clipboard'. Solution: Make the use of the star register work as documented. (Ernie Rael, closes #10669)
author Bram Moolenaar <Bram@vim.org>
date Tue, 26 Jul 2022 15:45:03 +0200
parents a0cd2b7a78ef
children 83b25278bac3
line wrap: on
line diff
--- a/src/testdir/test_registers.vim
+++ b/src/testdir/test_registers.vim
@@ -411,6 +411,36 @@ func Test_clipboard_regs()
   bwipe!
 endfunc
 
+" Test unnamed for both clipboard registers (* and +)
+func Test_clipboard_regs_both_unnamed()
+  CheckNotGui
+  CheckFeature clipboard_working
+  CheckTwoClipboards
+
+  let @* = 'xxx'
+  let @+ = 'xxx'
+
+  new
+
+  set clipboard=unnamed,unnamedplus
+  call setline(1, ['foo', 'bar'])
+
+  " op_yank copies to both
+  :1
+  :normal yw
+  call assert_equal('foo', getreg('*'))
+  call assert_equal('foo', getreg('+'))
+
+  " op_delete only copies to '+'
+  :2
+  :normal dw
+  call assert_equal('foo', getreg('*'))
+  call assert_equal('bar', getreg('+'))
+
+  set clipboard&vim
+  bwipe!
+endfunc
+
 " Test for restarting the current mode (insert or virtual replace) after
 " executing the contents of a register
 func Test_put_reg_restart_mode()