patch 9.0.0449: there is no easy way to translate a key code into a string
Problem: There is no easy way to translate a string with a key code into a
readable string.
Solution: Add the keytrans() function. (closes #11114)
diff --git a/src/map.c b/src/map.c
index 140cbc8..d063e05 100644
--- a/src/map.c
+++ b/src/map.c
@@ -2317,7 +2317,7 @@
int buffer_local, // false if not buffer local mapping
int abbr) // true if abbreviation
{
- char_u *lhs = str2special_save(mp->m_keys, TRUE);
+ char_u *lhs = str2special_save(mp->m_keys, TRUE, FALSE);
char_u *mapmode = map_mode_to_chars(mp->m_mode);
dict_add_string(dict, "lhs", lhs);
@@ -2409,7 +2409,7 @@
if (*rhs == NUL)
rettv->vval.v_string = vim_strsave((char_u *)"<Nop>");
else
- rettv->vval.v_string = str2special_save(rhs, FALSE);
+ rettv->vval.v_string = str2special_save(rhs, FALSE, FALSE);
}
}
@@ -2478,7 +2478,7 @@
keys_buf = NULL;
did_simplify = FALSE;
- lhs = str2special_save(mp->m_keys, TRUE);
+ lhs = str2special_save(mp->m_keys, TRUE, FALSE);
(void)replace_termcodes(lhs, &keys_buf, flags, &did_simplify);
vim_free(lhs);