mirror of
https://github.com/neovim/neovim.git
synced 2026-08-24 08:01:53 +00:00
vim-patch:8.2.1035: setreg() does not always clear the register
Problem: setreg() does not always clear the register.
Solution: Clear the register if the dict argument is empty. (Andy Massimino,
closes vim/vim#3370)
7633fe595e
Do not getdigits for block_len strictly. For example, a user could
previously abort Nvim using:
:call setreg("0", "abort!", "\<C-V>999999999999999999")
or, after v8.2.0924's port:
:call setreg("0", #{regcontents: ["abort!"],
\ regtype: "\<C-V>999999999999999999"})
Instead, default to 0 so block_len is -1, which acts like the selection
width was omitted (defaults to length of longest line).
This commit is contained in:
@@ -352,6 +352,14 @@ func Test_set_register_dict()
|
||||
call assert_equal(['six'], getreginfo('0').regcontents)
|
||||
call assert_equal(['six'], getreginfo('"').regcontents)
|
||||
|
||||
let @x = 'one'
|
||||
call setreg('x', {})
|
||||
call assert_equal(1, len(split(execute('reg x'), '\n')))
|
||||
|
||||
call assert_fails("call setreg('0', #{regtype: 'V'}, 'v')", 'E118:')
|
||||
call assert_fails("call setreg('0', #{regtype: 'X'})", 'E475:')
|
||||
call assert_fails("call setreg('0', #{regtype: 'vy'})", 'E475:')
|
||||
|
||||
bwipe!
|
||||
endfunc
|
||||
|
||||
|
||||
Reference in New Issue
Block a user