From 574ea6a1911b740bb611f0b658a83f606b6837bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mantas=20Mikul=C4=97nas?= Date: Thu, 20 Feb 2025 15:26:46 +0200 Subject: [PATCH] fix(keycodes): recognize , respectively. PuTTY is not unique here -- tmux *also* sends ESC[1~ and ESC[4~ after its internal translation -- but the difference is that 'tmux' terminfo correctly maps them to Home/End so Neovim recognizes them as such, while PuTTY defaults to using 'xterm' which uses a different mapping. This initial patch only allows Neovim to recognize and select key insert key home *home* end *end* diff --git a/src/nvim/keycodes.c b/src/nvim/keycodes.c index a9f8c9222a..b6ba73f7c1 100644 --- a/src/nvim/keycodes.c +++ b/src/nvim/keycodes.c @@ -261,6 +261,8 @@ static const struct key_name_entry { { K_HELP, "Help" }, { K_UNDO, "Undo" }, + { K_FIND, "Find" }, // DEC key, often used as 'Home' + { K_KSELECT, "Select" }, // DEC key, often used as 'End' { K_INS, "Insert" }, { K_INS, "Ins" }, // Alternative name { K_KINS, "kInsert" }, diff --git a/src/nvim/keycodes.h b/src/nvim/keycodes.h index 5a7ddd4847..e24e30e7d0 100644 --- a/src/nvim/keycodes.h +++ b/src/nvim/keycodes.h @@ -352,6 +352,8 @@ enum key_extra { #define K_HELP TERMCAP2KEY('%', '1') #define K_UNDO TERMCAP2KEY('&', '8') +#define K_FIND TERMCAP2KEY('@', '0') // DEC key, often used as Home +#define K_KSELECT TERMCAP2KEY('*', '6') // DEC key, often used as End #define K_BS TERMCAP2KEY('k', 'b') diff --git a/test/functional/ui/input_spec.lua b/test/functional/ui/input_spec.lua index 98312c42c9..bc1f3480e1 100644 --- a/test/functional/ui/input_spec.lua +++ b/test/functional/ui/input_spec.lua @@ -62,6 +62,8 @@ describe('mappings', function() add_mapping('', '') add_mapping('', '') add_mapping('', '') + add_mapping('', '') + add_mapping('') add_mapping('', '') add_mapping('', '') end) @@ -130,6 +132,8 @@ describe('mappings', function() check_mapping('', '') check_mapping('', '') check_mapping('', '') + check_mapping('', '') + check_mapping('') check_mapping('', '') check_mapping('', '') end)