From cba53ec9f6f05af21b9c28dc57ad9f3bb8f614ef Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Sat, 6 Nov 2021 13:19:02 -0700 Subject: reorg editor transitions --- src/lua.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src/lua.c') diff --git a/src/lua.c b/src/lua.c index 1c7cdfd..34fcd13 100644 --- a/src/lua.c +++ b/src/lua.c @@ -74,16 +74,23 @@ static int report (lua_State *L, int status) { } +/* death and rebirth */ char *Script_name = NULL; char **Argv = NULL; extern void edit(char *filename, const char *status); +void switch_to_editor(const char *message) { + endwin(); + edit(Script_name, message); + execv(Argv[0], Argv); + /* never returns */ +} + + static int show_error_in_editor (lua_State *L, int status) { if (status && !lua_isnil(L, -1)) { const char *msg = lua_tostring(L, -1); if (msg == NULL) msg = "(error object is not a string)"; - endwin(); - edit(Script_name, msg); - execv(Argv[0], Argv); + switch_to_editor(msg); } return status; } -- cgit 1.4.1-2-gfad0