aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2024-10-12 08:07:05 +0800
committerGitHub <noreply@github.com>2024-10-12 08:07:05 +0800
commit0e42c81c7fd429529d89458349c7cdde254d5406 (patch)
tree4504e1e7382f27d80aaf5914d61c3bdf729ee456 /src
parentc49030b75ad8b8a9f8e7f023b0ee5f9c8c40afdd (diff)
downloadrneovim-0e42c81c7fd429529d89458349c7cdde254d5406.tar.gz
rneovim-0e42c81c7fd429529d89458349c7cdde254d5406.tar.bz2
rneovim-0e42c81c7fd429529d89458349c7cdde254d5406.zip
fix(lua): avoid recursive vim.on_key() callback (#30753)
Diffstat (limited to 'src')
-rw-r--r--src/nvim/lua/executor.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/nvim/lua/executor.c b/src/nvim/lua/executor.c
index d4940f3add..9392765f40 100644
--- a/src/nvim/lua/executor.c
+++ b/src/nvim/lua/executor.c
@@ -2065,6 +2065,13 @@ char *nlua_register_table_as_callable(const typval_T *const arg)
void nlua_execute_on_key(int c, char *typed_buf)
{
+ static bool recursive = false;
+
+ if (recursive) {
+ return;
+ }
+ recursive = true;
+
char buf[MB_MAXBYTES * 3 + 4];
size_t buf_len = special_to_buf(c, mod_mask, false, buf);
vim_unescape_ks(typed_buf);
@@ -2103,6 +2110,8 @@ void nlua_execute_on_key(int c, char *typed_buf)
// [ ]
assert(top == lua_gettop(lstate));
#endif
+
+ recursive = false;
}
// Sets the editor "script context" during Lua execution. Used by :verbose.