1
0
forked from aniani/vim

patch 8.1.2350: other text for CTRL-V in Insert mode with modifyOtherKeys

Problem:    Other text for CTRL-V in Insert mode with modifyOtherKeys.
Solution:   Convert the Escape sequence back to key as if modifyOtherKeys is
            not set, and use CTRL-SHIFT-V to get the Escape sequence itself.
            (closes #5254)
This commit is contained in:
Bram Moolenaar
2019-11-26 19:33:22 +01:00
parent cc4423ae13
commit fc4ea2a72d
11 changed files with 182 additions and 34 deletions

View File

@@ -1349,3 +1349,48 @@ func Test_mapping_works_with_shift_ctrl_alt()
call RunTest_mapping_works_with_mods(function('GetEscCodeCSI27'), 'C-S-A', 8)
call RunTest_mapping_works_with_mods(function('GetEscCodeCSIu'), 'C-S-A', 8)
endfunc
func Test_insert_literal()
set timeoutlen=10
new
" CTRL-V CTRL-X inserts a ^X
call feedkeys('a' .. GetEscCodeCSIu('V', '5') .. GetEscCodeCSIu('X', '5') .. "\<Esc>", 'Lx!')
call assert_equal("\<C-X>", getline(1))
call setline(1, '')
call feedkeys('a' .. GetEscCodeCSI27('V', '5') .. GetEscCodeCSI27('X', '5') .. "\<Esc>", 'Lx!')
call assert_equal("\<C-X>", getline(1))
" CTRL-SHIFT-V CTRL-X inserts escape sequencd
call setline(1, '')
call feedkeys('a' .. GetEscCodeCSIu('V', '6') .. GetEscCodeCSIu('X', '5') .. "\<Esc>", 'Lx!')
call assert_equal("\<Esc>[88;5u", getline(1))
call setline(1, '')
call feedkeys('a' .. GetEscCodeCSI27('V', '6') .. GetEscCodeCSI27('X', '5') .. "\<Esc>", 'Lx!')
call assert_equal("\<Esc>[27;5;88~", getline(1))
bwipe!
set timeoutlen&
endfunc
func Test_cmdline_literal()
set timeoutlen=10
" CTRL-V CTRL-Y inserts a ^Y
call feedkeys(':' .. GetEscCodeCSIu('V', '5') .. GetEscCodeCSIu('Y', '5') .. "\<C-B>\"\<CR>", 'Lx!')
call assert_equal("\"\<C-Y>", @:)
call feedkeys(':' .. GetEscCodeCSI27('V', '5') .. GetEscCodeCSI27('Y', '5') .. "\<C-B>\"\<CR>", 'Lx!')
call assert_equal("\"\<C-Y>", @:)
" CTRL-SHIFT-V CTRL-Y inserts escape sequencd
call feedkeys(':' .. GetEscCodeCSIu('V', '6') .. GetEscCodeCSIu('Y', '5') .. "\<C-B>\"\<CR>", 'Lx!')
call assert_equal("\"\<Esc>[89;5u", @:)
call setline(1, '')
call feedkeys(':' .. GetEscCodeCSI27('V', '6') .. GetEscCodeCSI27('Y', '5') .. "\<C-B>\"\<CR>", 'Lx!')
call assert_equal("\"\<Esc>[27;5;89~", @:)
set timeoutlen&
endfunc