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)
diff --git a/src/testdir/test_termcodes.vim b/src/testdir/test_termcodes.vim
index 05f0d18..298244e 100644
--- a/src/testdir/test_termcodes.vim
+++ b/src/testdir/test_termcodes.vim
@@ -1349,3 +1349,48 @@
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