diff options
| author | zeertzjq <zeertzjq@outlook.com> | 2024-04-18 06:23:11 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-04-18 06:23:11 +0800 |
| commit | 562719033ec8bec9f6d56c166b9aef13f8a50a96 (patch) | |
| tree | cef907a538f9bbcf31c5072dedd9842e3f5ff40f /test/old/testdir | |
| parent | de6eb96fc92ed73237080c1d6a342844fda036fc (diff) | |
| download | rneovim-562719033ec8bec9f6d56c166b9aef13f8a50a96.tar.gz rneovim-562719033ec8bec9f6d56c166b9aef13f8a50a96.tar.bz2 rneovim-562719033ec8bec9f6d56c166b9aef13f8a50a96.zip | |
vim-patch:9.1.0343: 'showcmd' wrong for partial mapping with multibyte (#28392)
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: vim/vim#14572
https://github.com/vim/vim/commit/acdfb8a97995e0f81832207e39564ba795281108
Diffstat (limited to 'test/old/testdir')
| -rw-r--r-- | test/old/testdir/test_mapping.vim | 45 |
1 files changed, 43 insertions, 2 deletions
diff --git a/test/old/testdir/test_mapping.vim b/test/old/testdir/test_mapping.vim index 623228b347..811a260238 100644 --- a/test/old/testdir/test_mapping.vim +++ b/test/old/testdir/test_mapping.vim @@ -1693,7 +1693,7 @@ func Test_map_after_timed_out_nop() inoremap ab TEST inoremap a <Nop> END - call writefile(lines, 'Xtest_map_after_timed_out_nop') + call writefile(lines, 'Xtest_map_after_timed_out_nop', 'D') let buf = RunVimInTerminal('-S Xtest_map_after_timed_out_nop', #{rows: 6}) " Enter Insert mode @@ -1710,7 +1710,48 @@ func Test_map_after_timed_out_nop() " clean up call StopVimInTerminal(buf) - call delete('Xtest_map_after_timed_out_nop') +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() |