mirror of
https://github.com/neovim/neovim.git
synced 2025-10-21 09:12:07 +00:00
fix(paste): only record a paste when it's from RPC (#30491)
Problem: When using nvim_paste in a mapping during a macro recording, both the mapping and the paste are recorded, causing the paste to be performed twice when replaying the macro. Solution: Only record a paste when it is from RPC. Unfortunately this means there is no way for a script to make a recorded paste. A way to enable that can be discussed later if there is need.
This commit is contained in:
@@ -1358,6 +1358,13 @@ describe('API', function()
|
||||
test_paste_repeat_visual_select(true)
|
||||
end)
|
||||
end)
|
||||
it('in a mapping recorded in a macro', function()
|
||||
command([[nnoremap <F2> <Cmd>call nvim_paste('foo', v:false, -1)<CR>]])
|
||||
feed('qr<F2>$q')
|
||||
expect('foo')
|
||||
feed('@r') -- repeating a macro containing the mapping should only paste once
|
||||
expect('foofoo')
|
||||
end)
|
||||
local function test_paste_cancel_error(is_error)
|
||||
before_each(function()
|
||||
exec_lua(([[
|
||||
|
Reference in New Issue
Block a user