diff options
author | Daniel Hahler <git@thequod.de> | 2019-09-25 09:15:33 +0200 |
---|---|---|
committer | Daniel Hahler <git@thequod.de> | 2019-10-01 02:11:40 +0200 |
commit | 36e2846b493d7e03ee92b20e66387038cbeb25fa (patch) | |
tree | 6dd4a865ce5b9fcf9a0d2f6c5a6d9745266ae6db | |
parent | 60b56ed458c6b35d5045959192b49da5a0ea84f3 (diff) | |
download | rneovim-36e2846b493d7e03ee92b20e66387038cbeb25fa.tar.gz rneovim-36e2846b493d7e03ee92b20e66387038cbeb25fa.tar.bz2 rneovim-36e2846b493d7e03ee92b20e66387038cbeb25fa.zip |
[release-0.4] paste: fix handling of "<" in cmdline (#11094)
Fixes https://github.com/neovim/neovim/issues/11088.
-rw-r--r-- | src/nvim/lua/vim.lua | 2 | ||||
-rw-r--r-- | test/functional/terminal/tui_spec.lua | 17 |
2 files changed, 18 insertions, 1 deletions
diff --git a/src/nvim/lua/vim.lua b/src/nvim/lua/vim.lua index a03e97490d..b1a684b977 100644 --- a/src/nvim/lua/vim.lua +++ b/src/nvim/lua/vim.lua @@ -189,7 +189,7 @@ paste = (function() if mode == 'c' and not got_line1 then -- cmdline-mode: paste only 1 line. got_line1 = (#lines > 1) vim.api.nvim_set_option('paste', true) -- For nvim_input(). - local line1, _ = string.gsub(lines[1], '[\r\n\012\027]', ' ') -- Scrub. + local line1 = lines[1]:gsub('<', '<lt>'):gsub('[\r\n\012\027]', ' ') -- Scrub. vim.api.nvim_input(line1) vim.api.nvim_set_option('paste', false) elseif mode ~= 'c' then -- Else: discard remaining cmdline-mode chunks. diff --git a/test/functional/terminal/tui_spec.lua b/test/functional/terminal/tui_spec.lua index c55093cb0f..5c871f1294 100644 --- a/test/functional/terminal/tui_spec.lua +++ b/test/functional/terminal/tui_spec.lua @@ -578,6 +578,23 @@ describe('TUI', function() ]]) end) + it('paste: less-than sign in cmdline #11088', function() + local expected = '<' + feed_data(':') + wait_for_mode('c') + -- "bracketed paste" + feed_data('\027[200~'..expected..'\027[201~') + screen:expect{grid=[[ + | + {4:~ }| + {4:~ }| + {4:~ }| + {5:[No Name] }| + :<{1: } | + {3:-- TERMINAL --} | + ]]} + end) + it('paste: big burst of input', function() feed_data(':set ruler\n') local t = {} |