diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2021-11-06 13:19:02 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2021-11-06 13:22:05 -0700 |
commit | cba53ec9f6f05af21b9c28dc57ad9f3bb8f614ef (patch) | |
tree | 54c8aee76ade113d0d3c44ad5e8649e2d45c37ff /src/lua.c | |
parent | 3305ac0b90ae7f41de7f288fb0fea72f616f617c (diff) | |
download | teliva-cba53ec9f6f05af21b9c28dc57ad9f3bb8f614ef.tar.gz |
reorg editor transitions
Diffstat (limited to 'src/lua.c')
-rw-r--r-- | src/lua.c | 13 |
1 files changed, 10 insertions, 3 deletions
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; } |