about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2021-12-03 16:12:51 -0800
committerKartik K. Agaram <vc@akkartik.com>2021-12-03 16:12:51 -0800
commit6f6595b39a8e9bdae71e1ea4521e6778b5eb331c (patch)
tree41728aa8502208c6a03cf4c2bcf4c1292e17e6a3
parentc7dea9f5a33450de289bf3681ffd1eb3765a92a4 (diff)
downloadteliva-6f6595b39a8e9bdae71e1ea4521e6778b5eb331c.tar.gz
show state of screen on runtime error
This is essential when debugging.
-rw-r--r--src/lua.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/lua.c b/src/lua.c
index c5b5cb9..00a9349 100644
--- a/src/lua.c
+++ b/src/lua.c
@@ -98,6 +98,13 @@ static int report_in_developer_mode (lua_State *L, int status) {
     const char *msg = strdup(lua_tostring(L, -1));  /* memory leak */
     if (msg == NULL) msg = "(error object is not a string)";
     lua_pop(L, 1);
+    for (int x = 0; x < COLS; ++x) {
+      mvaddch(LINES-2, x, ' ');
+      mvaddch(LINES-1, x, ' ');
+    }
+    mvaddstr(LINES-2, 0, msg);
+    mvaddstr(LINES-1, 0, "press any key to continue");
+    getch();
     developer_mode(L, msg);
   }
   return status;