aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/lua/executor.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2024-07-13 04:14:29 +0800
committerGitHub <noreply@github.com>2024-07-13 04:14:29 +0800
commit16f63b964fc4a7842fd9a2fd5e0ba8c997d549c9 (patch)
tree1eff1b2ff523674d2723bbc49f25e5d0285544f6 /src/nvim/lua/executor.c
parent8d8b8af2d2b837c9a7a4005b943a8a4c9bfc391d (diff)
downloadrneovim-16f63b964fc4a7842fd9a2fd5e0ba8c997d549c9.tar.gz
rneovim-16f63b964fc4a7842fd9a2fd5e0ba8c997d549c9.tar.bz2
rneovim-16f63b964fc4a7842fd9a2fd5e0ba8c997d549c9.zip
fix(input): handle vim.on_key() properly with ALT and K_SPECIAL (#29677)
Diffstat (limited to 'src/nvim/lua/executor.c')
-rw-r--r--src/nvim/lua/executor.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/nvim/lua/executor.c b/src/nvim/lua/executor.c
index c29e670c33..4d5b2c3698 100644
--- a/src/nvim/lua/executor.c
+++ b/src/nvim/lua/executor.c
@@ -2057,10 +2057,11 @@ char *nlua_register_table_as_callable(const typval_T *const arg)
return name;
}
-void nlua_execute_on_key(int c, char *typed_buf, size_t typed_len)
+void nlua_execute_on_key(int c, char *typed_buf)
{
char buf[MB_MAXBYTES * 3 + 4];
size_t buf_len = special_to_buf(c, mod_mask, false, buf);
+ vim_unescape_ks(typed_buf);
lua_State *const lstate = global_lstate;
@@ -2079,7 +2080,7 @@ void nlua_execute_on_key(int c, char *typed_buf, size_t typed_len)
lua_pushlstring(lstate, buf, buf_len);
// [ vim, vim._on_key, buf, typed_buf ]
- lua_pushlstring(lstate, typed_buf, typed_len);
+ lua_pushstring(lstate, typed_buf);
int save_got_int = got_int;
got_int = false; // avoid interrupts when the key typed is Ctrl-C