aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/keycodes.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-08-13 22:14:48 +0800
committerGitHub <noreply@github.com>2023-08-13 22:14:48 +0800
commit017ff93b020e1915d03d9a2dd9a895613148f181 (patch)
tree56545bb90cc8362b3541cb5d5ff174a4f247f50e /src/nvim/keycodes.c
parentcbf54ec2a5aaa1a00ff89e26bab44a30d09d4631 (diff)
downloadrneovim-017ff93b020e1915d03d9a2dd9a895613148f181.tar.gz
rneovim-017ff93b020e1915d03d9a2dd9a895613148f181.tar.bz2
rneovim-017ff93b020e1915d03d9a2dd9a895613148f181.zip
fix(keycodes): recognize <t_xx> as a key (#24700)
Problem: The result of keytrans() sometimes can't be translated back. Solution: Recognize <t_xx> as a key.
Diffstat (limited to 'src/nvim/keycodes.c')
-rw-r--r--src/nvim/keycodes.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/nvim/keycodes.c b/src/nvim/keycodes.c
index 6c64a2ca4a..f2391cc541 100644
--- a/src/nvim/keycodes.c
+++ b/src/nvim/keycodes.c
@@ -825,6 +825,10 @@ int find_special_key_in_table(int c)
int get_special_key_code(const char *name)
FUNC_ATTR_NONNULL_ALL FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT
{
+ if (name[0] == 't' && name[1] == '_' && name[2] != NUL && name[3] != NUL) {
+ return TERMCAP2KEY((uint8_t)name[2], (uint8_t)name[3]);
+ }
+
for (int i = 0; key_names_table[i].name != NULL; i++) {
const char *const table_name = key_names_table[i].name;
int j;