aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/_editor.lua
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-03-15 06:04:50 +0800
committerzeertzjq <zeertzjq@outlook.com>2022-03-15 18:15:18 +0800
commite263afc0e972d11d3b9b663c3ac0b5575c4deb88 (patch)
treec3ed700a411bba1c69bfbd624bd68871b02c4e80 /runtime/lua/vim/_editor.lua
parent3470a9c3de076ec3170525c3de66544f9836c775 (diff)
downloadrneovim-e263afc0e972d11d3b9b663c3ac0b5575c4deb88.tar.gz
rneovim-e263afc0e972d11d3b9b663c3ac0b5575c4deb88.tar.bz2
rneovim-e263afc0e972d11d3b9b663c3ac0b5575c4deb88.zip
fix(paste): escape control characters in Cmdline mode
Diffstat (limited to 'runtime/lua/vim/_editor.lua')
-rw-r--r--runtime/lua/vim/_editor.lua3
1 files changed, 2 insertions, 1 deletions
diff --git a/runtime/lua/vim/_editor.lua b/runtime/lua/vim/_editor.lua
index 26b9693189..d4db4850bd 100644
--- a/runtime/lua/vim/_editor.lua
+++ b/runtime/lua/vim/_editor.lua
@@ -175,7 +175,8 @@ do
if not got_line1 then
got_line1 = (#lines > 1)
vim.api.nvim_set_option('paste', true) -- For nvim_input().
- local line1 = lines[1]:gsub('<', '<lt>'):gsub('[\r\n\012\027]', ' ') -- Scrub.
+ -- Escape "<" and control characters
+ local line1 = lines[1]:gsub('<', '<lt>'):gsub('(%c)', '\022%1')
vim.api.nvim_input(line1)
vim.api.nvim_set_option('paste', false)
end