mirror of
https://github.com/neovim/neovim.git
synced 2025-01-01 17:23:36 -07:00
Merge pull request #20960 from neovim/backport-20959-to-release-0.8
[Backport release-0.8] fix(paste): feed keys as typed in cmdline mode
This commit is contained in:
commit
b0cb9a8ad0
@ -168,7 +168,8 @@ do
|
|||||||
local line1 = lines[1]:gsub('(%c)', '\022%1')
|
local line1 = lines[1]:gsub('(%c)', '\022%1')
|
||||||
-- nvim_input() is affected by mappings,
|
-- nvim_input() is affected by mappings,
|
||||||
-- so use nvim_feedkeys() with "n" flag to ignore mappings.
|
-- so use nvim_feedkeys() with "n" flag to ignore mappings.
|
||||||
vim.api.nvim_feedkeys(line1, 'n', true)
|
-- "t" flag is also needed so the pasted text is saved in cmdline history.
|
||||||
|
vim.api.nvim_feedkeys(line1, 'nt', true)
|
||||||
end
|
end
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
@ -1108,6 +1108,14 @@ describe('API', function()
|
|||||||
nvim('paste', 'a', true, -1)
|
nvim('paste', 'a', true, -1)
|
||||||
eq('a', funcs.getcmdline())
|
eq('a', funcs.getcmdline())
|
||||||
end)
|
end)
|
||||||
|
it('pasted text is saved in cmdline history when <CR> comes from mapping #20957', function()
|
||||||
|
command('cnoremap <CR> <CR>')
|
||||||
|
feed(':')
|
||||||
|
nvim('paste', 'echo', true, -1)
|
||||||
|
eq('', funcs.histget(':'))
|
||||||
|
feed('<CR>')
|
||||||
|
eq('echo', funcs.histget(':'))
|
||||||
|
end)
|
||||||
it('pasting with empty last chunk in Cmdline mode', function()
|
it('pasting with empty last chunk in Cmdline mode', function()
|
||||||
local screen = Screen.new(20, 4)
|
local screen = Screen.new(20, 4)
|
||||||
screen:attach()
|
screen:attach()
|
||||||
|
Loading…
Reference in New Issue
Block a user