Merge pull request #16936 from zeertzjq/no-escape-csi

input: never escape CSI bytes and clean up related names and comments
This commit is contained in:
bfredl
2022-01-21 18:04:40 +01:00
committed by GitHub
13 changed files with 135 additions and 172 deletions

View File

@@ -1367,18 +1367,18 @@ describe('API', function()
end)
describe('nvim_feedkeys', function()
it('CSI escaping', function()
it('K_SPECIAL escaping', function()
local function on_setup()
-- notice the special char(…) \xe2\80\xa6
nvim('feedkeys', ':let x1="…"\n', '', true)
-- Both nvim_replace_termcodes and nvim_feedkeys escape \x80
local inp = helpers.nvim('replace_termcodes', ':let x2="…"<CR>', true, true, true)
nvim('feedkeys', inp, '', true) -- escape_csi=true
nvim('feedkeys', inp, '', true) -- escape_ks=true
-- nvim_feedkeys with CSI escaping disabled
-- nvim_feedkeys with K_SPECIAL escaping disabled
inp = helpers.nvim('replace_termcodes', ':let x3="…"<CR>', true, true, true)
nvim('feedkeys', inp, '', false) -- escape_csi=false
nvim('feedkeys', inp, '', false) -- escape_ks=false
helpers.stop()
end

View File

@@ -114,11 +114,30 @@ describe('mappings', function()
end)
end)
describe('input utf sequences that contain CSI/K_SPECIAL', function()
describe('input utf sequences that contain K_SPECIAL (0x80)', function()
it('ok', function()
feed('i…<esc>')
expect('')
end)
it('can be mapped', function()
command('inoremap … E280A6')
feed('i…<esc>')
expect('E280A6')
end)
end)
describe('input utf sequences that contain CSI (0x9B)', function()
it('ok', function()
feed('iě<esc>')
expect('ě')
end)
it('can be mapped', function()
command('inoremap ě C49B')
feed('iě<esc>')
expect('C49B')
end)
end)
describe('input non-printable chars', function()