aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--vis-core.h1
-rw-r--r--vis-lua.c4
2 files changed, 5 insertions, 0 deletions
diff --git a/vis-core.h b/vis-core.h
index 74de5a1..fb34a1b 100644
--- a/vis-core.h
+++ b/vis-core.h
@@ -164,6 +164,7 @@ struct Vis {
Buffer input_queue; /* holds pending input keys */
Buffer *keys; /* currently active keys buffer (either the input_queue or a macro) */
bool keyhandler; /* whether a key handling function is currently being called */
+ bool errorhandler; /* whether we are currently in an error handler, used to avoid recursion */
Action action; /* current action which is in progress */
Action action_prev; /* last operator action used by the repeat (dot) command */
Mode *mode; /* currently active mode, used to search for keybindings */
diff --git a/vis-lua.c b/vis-lua.c
index fdc4fd2..eb54576 100644
--- a/vis-lua.c
+++ b/vis-lua.c
@@ -135,12 +135,16 @@ static void stack_dump(lua_State *L, const char *format, ...) {
static int error_function(lua_State *L) {
Vis *vis = lua_touserdata(L, lua_upvalueindex(1));
+ if (vis->errorhandler)
+ return 1;
+ vis->errorhandler = true;
size_t len;
const char *msg = lua_tostring(L, 1);
if (msg)
luaL_traceback(L, L, msg, 1);
msg = lua_tolstring(L, 1, &len);
vis_message_show(vis, msg);
+ vis->errorhandler = false;
return 1;
}