diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2021-11-26 16:39:20 -0800 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2021-11-26 16:39:20 -0800 |
commit | 0b365d3e4d5e4a9db125870490ceae2d3c1bb065 (patch) | |
tree | a433e73e9509ccb036f5af25b84e4634ce45e27e /src | |
parent | e699b5a052e7e5b2de89dfb0955e63d5349bf964 (diff) | |
download | teliva-0b365d3e4d5e4a9db125870490ceae2d3c1bb065.tar.gz |
clean up terminal in a specific situation
The problem: if ever I hit ctrl-e to go to the big picture view and then hit Esc to go back to running the app, my terminal was messed up after exiting the app. Why did I even have this gunk? Perhaps it dates from the time when kilo was emitting raw escape sequences rather than using ncurses.
Diffstat (limited to 'src')
-rw-r--r-- | src/lua.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/lua.c b/src/lua.c index 528e383..4c6ee62 100644 --- a/src/lua.c +++ b/src/lua.c @@ -525,7 +525,7 @@ void draw_definition_name (const char *definition_name) { } /* return true if submitted */ -int big_picture (lua_State *L) { +void big_picture (lua_State *L) { clear(); luaL_newmetatable(L, "__teliva_call_graph_depth"); int cgt = lua_gettop(L); @@ -643,11 +643,11 @@ int big_picture (lua_State *L) { if (c == KEY_BACKSPACE) { if (qlen != 0) query[--qlen] = '\0'; } else if (c == ESC) { - return 0; + return; } else if (c == ENTER) { int back_to_big_picture = edit_image(L, query); - if (back_to_big_picture) return big_picture(L); // retry while leaking stack - return 1; + if (back_to_big_picture) big_picture(L); // retry while leaking stack + return; } else if (c == CTRL_U) { qlen = 0; query[qlen] = '\0'; @@ -670,9 +670,8 @@ void switch_to_editor (lua_State *L) { for (int i = 0; i < 8; ++i) init_pair(i+8, -1, i); nodelay(stdscr, 0); - int submitted = big_picture(L); - if (submitted) - cleanup_curses(); + big_picture(L); + cleanup_curses(); execv(Argv[0], Argv); /* never returns */ } |