summaryrefslogtreecommitdiff
path: root/src/testdir/test_termcodes.vim
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-11-26 19:33:22 +0100
committerBram Moolenaar <Bram@vim.org>2019-11-26 19:33:22 +0100
commitfc4ea2a72d36de1196a3ce17352e72f8fe90f4bb (patch)
treed5d681840040dc4e36b94bb94cef2cb972c052b0 /src/testdir/test_termcodes.vim
parentcc4423ae13d78367a3d0b5756783523d3b3a1d31 (diff)
downloadvim-git-fc4ea2a72d36de1196a3ce17352e72f8fe90f4bb.tar.gz
patch 8.1.2350: other text for CTRL-V in Insert mode with modifyOtherKeysv8.1.2350
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)
Diffstat (limited to 'src/testdir/test_termcodes.vim')
-rw-r--r--src/testdir/test_termcodes.vim45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/testdir/test_termcodes.vim b/src/testdir/test_termcodes.vim
index 05f0d18df..298244e43 100644
--- a/src/testdir/test_termcodes.vim
+++ b/src/testdir/test_termcodes.vim
@@ -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