about summary refs log tree commit diff stats
path: root/src/lua.c
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2021-12-13 09:59:49 -0800
committerKartik K. Agaram <vc@akkartik.com>2021-12-13 09:59:52 -0800
commitb425593af6689c14e816dddc0e733636d78d99f1 (patch)
treeed587815882ff5f9bdc6fa95b21ea0d19d47a295 /src/lua.c
parentd043d67744c6cfa886bce5cc538a1c58291d2682 (diff)
downloadteliva-b425593af6689c14e816dddc0e733636d78d99f1.tar.gz
show all functions in big picture
We were missing functions in some larger programs.
Diffstat (limited to 'src/lua.c')
-rw-r--r--src/lua.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/lua.c b/src/lua.c
index 4171856..ac6e249 100644
--- a/src/lua.c
+++ b/src/lua.c
@@ -779,8 +779,9 @@ restart:
   y += 2;
   mvprintw(y, 0, "functions: ");
   y++;
-  for (int level = 1; level < 5; ++level) {
+  for (int level = 1; ; ++level) {
     mvaddstr(y, 0, "                ");
+    bool drew_anything = false;
     for (int i = history_array_size; i > 0; --i) {
       lua_rawgeti(L, history_array, i);
       int t = lua_gettop(L);
@@ -789,14 +790,17 @@ restart:
         if (is_special_history_key(definition_name)) continue;
         lua_getfield(L, cgt, definition_name);
         int depth = lua_tointeger(L, -1);
-        if (depth == level)
+        if (depth == level) {
           if (is_current_definition(L, definition_name, i, history_array, history_array_size))
             draw_definition_name(definition_name);
+          drew_anything = true;
+        }
         lua_pop(L, 1);  // depth of value
       }
       lua_pop(L, 1);  // history element
     }
     y += 2;
+    if (!drew_anything) break;
   }
 
   // unused functions