summaryrefslogtreecommitdiffstats
path: root/src/testdir
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2024-04-17 21:28:54 +0200
committerChristian Brabandt <cb@256bit.org>2024-04-17 21:28:54 +0200
commitacdfb8a97995e0f81832207e39564ba795281108 (patch)
tree43ac60dc7ab26bc680c9949af1dfca66a73731e5 /src/testdir
parentae7e61c928b4adaa220e59ecebc75ef630674207 (diff)
patch 9.1.0343: 'showcmd' wrong for partial mapping with multibytev9.1.0343
Problem: 'showcmd' is wrong for partial mapping with multibyte char, and isn't very readable with modifyOtherKeys. Solution: Decode multibyte char and merge modifiers into the char. (zeertzjq) This improves the following situations: - Multibyte chars whose individual bytes are considered unprintable are now shown properly in 'showcmd' area. - Ctrl-W with modifyOtherKeys now shows ^W in 'showcmd' area. The following situation may still need improvement: - If the char is a special key or has modifiers that cannot be merged into it, internal keycodes are shown in 'showcmd' area like before. This applies to keys typed in Normal mode commands as well, and it's hard to decide how to make it more readable due to the limited space taken by 'showcmd', so I'll leave it for later. closes: #14572 Signed-off-by: zeertzjq <zeertzjq@outlook.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
Diffstat (limited to 'src/testdir')
-rw-r--r--src/testdir/test_mapping.vim42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/testdir/test_mapping.vim b/src/testdir/test_mapping.vim
index 71d90468ba..309be71226 100644
--- a/src/testdir/test_mapping.vim
+++ b/src/testdir/test_mapping.vim
@@ -1807,6 +1807,48 @@ func Test_map_after_timed_out_nop()
call StopVimInTerminal(buf)
endfunc
+" Test 'showcmd' behavior with a partial mapping
+func Test_showcmd_part_map()
+ CheckRunVimInTerminal
+
+ let lines =<< trim eval END
+ set notimeout showcmd
+ nnoremap ,a <Ignore>
+ nnoremap ;a <Ignore>
+ nnoremap Àa <Ignore>
+ nnoremap Ëa <Ignore>
+ nnoremap βa <Ignore>
+ nnoremap ωa <Ignore>
+ nnoremap …a <Ignore>
+ nnoremap <C-W>a <Ignore>
+ END
+ call writefile(lines, 'Xtest_showcmd_part_map', 'D')
+ let buf = RunVimInTerminal('-S Xtest_showcmd_part_map', #{rows: 6})
+
+ call term_sendkeys(buf, ":set noruler | echo\<CR>")
+ call WaitForAssert({-> assert_equal('', term_getline(buf, 6))})
+
+ for c in [',', ';', 'À', 'Ë', 'β', 'ω', '…']
+ call term_sendkeys(buf, c)
+ call WaitForAssert({-> assert_equal(c, trim(term_getline(buf, 6)))})
+ call term_sendkeys(buf, "\<C-C>:echo\<CR>")
+ call WaitForAssert({-> assert_equal('', term_getline(buf, 6))})
+ endfor
+
+ call term_sendkeys(buf, "\<C-W>")
+ call WaitForAssert({-> assert_equal('^W', trim(term_getline(buf, 6)))})
+ call term_sendkeys(buf, "\<C-C>:echo\<CR>")
+ call WaitForAssert({-> assert_equal('', term_getline(buf, 6))})
+
+ " Use feedkeys() as terminal buffer cannot forward this
+ call term_sendkeys(buf, ':call feedkeys("\<*C-W>", "m")' .. " | echo\<CR>")
+ call WaitForAssert({-> assert_equal('^W', trim(term_getline(buf, 6)))})
+ call term_sendkeys(buf, "\<C-C>:echo\<CR>")
+ call WaitForAssert({-> assert_equal('', term_getline(buf, 6))})
+
+ call StopVimInTerminal(buf)
+endfunc
+
func Test_using_past_typeahead()
nnoremap :00 0
exe "norm :set \x80\xfb0=0\<CR>"