From 0c211dec77716ecd06d8beb81f84167a5c4bc7c0 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Fri, 26 Nov 2021 20:00:32 -0800 Subject: don't mislead immediately after undo --- src/lua.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/lua.c b/src/lua.c index 95532f8..9a57e52 100644 --- a/src/lua.c +++ b/src/lua.c @@ -639,8 +639,14 @@ void recent_changes (lua_State *L) { assert(history_array == 1); int history_array_size = luaL_getn(L, history_array); int cursor = history_array_size; + lua_pop(L, 1); int quit = 0; while (!quit) { + /* refresh state after each operation so we pick up modifications */ + lua_getglobal(L, "teliva_program"); + int history_array = lua_gettop(L); + assert(history_array == 1); + int history_array_size = luaL_getn(L, history_array); render_recent_changes(L, history_array, cursor, history_array_size); int c = getch(); switch (c) { @@ -658,8 +664,8 @@ void recent_changes (lua_State *L) { add_undo_event(L, cursor); break; } + lua_pop(L, 1); } - lua_pop(L, 1); } -- cgit 1.4.1-2-gfad0