diff options
| author | zeertzjq <zeertzjq@outlook.com> | 2022-05-05 07:23:27 +0800 | 
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-05-05 07:23:27 +0800 | 
| commit | beb8f484891f5361cc2ee757b93b4e4aba228612 (patch) | |
| tree | d8055e292e6c3a6936f01e137f6ea87add838dbf /src/nvim/getchar.c | |
| parent | 6798f1fab0244ee535675fa9100945eec074e6e4 (diff) | |
| download | rneovim-beb8f484891f5361cc2ee757b93b4e4aba228612.tar.gz rneovim-beb8f484891f5361cc2ee757b93b4e4aba228612.tar.bz2 rneovim-beb8f484891f5361cc2ee757b93b4e4aba228612.zip  | |
vim-patch:8.2.4867: listing of mapping with K_SPECIAL is wrong (#18419)
Problem:    Listing of mapping with K_SPECIAL is wrong.
Solution:   Adjust escaping of special characters. (closes vim/vim#10351)
https://github.com/vim/vim/commit/ac402f4d64bec6b6efd809fef52f5b34627bf947
Avoid overshadowing.
Cherry-pick Test_list_mapping() from Vim patches 8.2.{0148,2994}.
Fix rhs_is_noop.
Diffstat (limited to 'src/nvim/getchar.c')
| -rw-r--r-- | src/nvim/getchar.c | 10 | 
1 files changed, 3 insertions, 7 deletions
diff --git a/src/nvim/getchar.c b/src/nvim/getchar.c index df9297dc0b..374fa11b23 100644 --- a/src/nvim/getchar.c +++ b/src/nvim/getchar.c @@ -2902,7 +2902,8 @@ void set_maparg_lhs_rhs(const char_u *const orig_lhs, const size_t orig_lhs_len,        replaced = replace_termcodes(orig_rhs, orig_rhs_len, &rhs_buf,                                     REPTERM_DO_LT | REPTERM_NO_SIMPLIFY, NULL, cpo_flags);        mapargs->rhs_len = STRLEN(replaced); -      mapargs->rhs_is_noop = false; +      // XXX: even when orig_rhs is non-empty, replace_termcodes may produce an empty string. +      mapargs->rhs_is_noop = orig_rhs[0] != NUL && mapargs->rhs_len == 0;        mapargs->rhs = xcalloc(mapargs->rhs_len + 1, sizeof(char_u));        STRLCPY(mapargs->rhs, replaced, mapargs->rhs_len + 1);      } @@ -3765,12 +3766,7 @@ static void showmap(mapblock_T *mp, bool local)    } else if (mp->m_str[0] == NUL) {      msg_puts_attr("<Nop>", HL_ATTR(HLF_8));    } else { -    // Remove escaping of K_SPECIAL, because "m_str" is in a format to be used -    // as typeahead. -    char_u *s = vim_strsave(mp->m_str); -    vim_unescape_ks(s); -    msg_outtrans_special(s, false, 0); -    xfree(s); +    msg_outtrans_special(mp->m_str, false, 0);    }    if (mp->m_desc != NULL) {  | 
