mirror of
https://github.com/neovim/neovim.git
synced 2025-09-28 22:18:33 +00:00
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
acdfb8a979
This commit is contained in:
@@ -1968,9 +1968,16 @@ bool add_to_showcmd(int c)
|
||||
}
|
||||
}
|
||||
|
||||
char *p = transchar(c);
|
||||
if (*p == ' ') {
|
||||
STRCPY(p, "<20>");
|
||||
char *p;
|
||||
char mbyte_buf[MB_MAXCHAR + 1];
|
||||
if (c <= 0x7f || !vim_isprintc(c)) {
|
||||
p = transchar(c);
|
||||
if (*p == ' ') {
|
||||
STRCPY(p, "<20>");
|
||||
}
|
||||
} else {
|
||||
mbyte_buf[utf_char2bytes(c, mbyte_buf)] = NUL;
|
||||
p = mbyte_buf;
|
||||
}
|
||||
size_t old_len = strlen(showcmd_buf);
|
||||
size_t extra_len = strlen(p);
|
||||
@@ -2036,7 +2043,7 @@ void pop_showcmd(void)
|
||||
|
||||
static void display_showcmd(void)
|
||||
{
|
||||
int len = (int)strlen(showcmd_buf);
|
||||
int len = vim_strsize(showcmd_buf);
|
||||
showcmd_is_clear = (len == 0);
|
||||
|
||||
if (*p_sloc == 's') {
|
||||
|
Reference in New Issue
Block a user