diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2021-11-26 20:00:32 -0800 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2021-11-26 20:00:32 -0800 |
commit | 0c211dec77716ecd06d8beb81f84167a5c4bc7c0 (patch) | |
tree | a685930e346cae85b2e77c001e9c1bc4194655ef /src | |
parent | b954ab869e6389ec396f7b144fa8ff0fcf3d5f6f (diff) | |
download | teliva-0c211dec77716ecd06d8beb81f84167a5c4bc7c0.tar.gz |
don't mislead immediately after undo
Diffstat (limited to 'src')
-rw-r--r-- | src/lua.c | 8 |
1 files changed, 7 insertions, 1 deletions
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); } |