Skip to content

Commit

Permalink
paste: fix handling of "<" in cmdline (#11094)
Browse files Browse the repository at this point in the history
Fixes #11088.
  • Loading branch information
blueyed committed Sep 25, 2019
1 parent db6b4b6 commit 0571145
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/nvim/lua/vim.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
17 changes: 17 additions & 0 deletions test/functional/terminal/tui_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -578,6 +578,23 @@ describe('TUI', function()
expect_child_buf_lines({expected})
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 = {}
Expand Down

0 comments on commit 0571145

Please sign in to comment.