aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/lua/executor.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2024-11-02 10:11:06 +0800
committerGitHub <noreply@github.com>2024-11-02 10:11:06 +0800
commit3688a333544251c887d78e6501eec55f0fb685f8 (patch)
tree746b606179500e2ecb5c4e93cac5b70e2e2e831f /src/nvim/lua/executor.c
parentb25ae5d328fd58bae5052d1ae19bd1d17a991ea8 (diff)
downloadrneovim-3688a333544251c887d78e6501eec55f0fb685f8.tar.gz
rneovim-3688a333544251c887d78e6501eec55f0fb685f8.tar.bz2
rneovim-3688a333544251c887d78e6501eec55f0fb685f8.zip
fix(lua): show stacktrace for error in vim.on_key() callback (#31021)
Diffstat (limited to 'src/nvim/lua/executor.c')
-rw-r--r--src/nvim/lua/executor.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/nvim/lua/executor.c b/src/nvim/lua/executor.c
index 27ebfacc5f..e4da274204 100644
--- a/src/nvim/lua/executor.c
+++ b/src/nvim/lua/executor.c
@@ -2099,9 +2099,9 @@ bool nlua_execute_on_key(int c, char *typed_buf)
int save_got_int = got_int;
got_int = false; // avoid interrupts when the key typed is Ctrl-C
bool discard = false;
- if (nlua_pcall(lstate, 2, 1)) {
- nlua_error(lstate,
- _("Error executing vim.on_key Lua callback: %.*s"));
+ // Do not use nlua_pcall here to avoid duplicate stack trace information
+ if (lua_pcall(lstate, 2, 1, 0)) {
+ nlua_error(lstate, _("Error executing vim.on_key() callbacks: %.*s"));
} else {
if (lua_isboolean(lstate, -1)) {
discard = lua_toboolean(lstate, -1);