about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2021-11-28 15:14:00 -0800
committerKartik K. Agaram <vc@akkartik.com>2021-11-28 15:14:00 -0800
commit37068ef8d2a768566738feaaf23e76478ae82e38 (patch)
tree8c66f0a754f054d6bf14766673ed7b603e912462
parent908b2634c6daab8a0d91127044aca1f2daef05bb (diff)
downloadteliva-37068ef8d2a768566738feaaf23e76478ae82e38.tar.gz
rename a fn and reorganize its responsibilities
-rw-r--r--src/lua.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/lua.c b/src/lua.c
index 102d1a1..22206f1 100644
--- a/src/lua.c
+++ b/src/lua.c
@@ -927,7 +927,7 @@ int editor_view_in_progress (lua_State *L) {
 }
 
 extern int edit_from(lua_State* L, char* filename, const char* message, int rowoff, int coloff, int cy, int cx);
-int editor_view (lua_State *L) {
+int restore_editor_view (lua_State *L) {
   lua_getglobal(L, "__teliva_editor_state");
   int editor_state_index = lua_gettop(L);
   lua_getfield(L, editor_state_index, "definition");
@@ -941,8 +941,8 @@ int editor_view (lua_State *L) {
   int cy = lua_tointeger(L, -1);
   lua_getfield(L, editor_state_index, "cx");
   int cx = lua_tointeger(L, -1);
-  int back_to_big_picture = edit_from(L, "teliva_editor_buffer", /*error message*/ "", rowoff, coloff, cy, cx);
   lua_settop(L, editor_state_index);
+  int back_to_big_picture = edit_from(L, "teliva_editor_buffer", /*error message*/ "", rowoff, coloff, cy, cx);
   // TODO: error handling like in edit_current_definition
   return back_to_big_picture;
 }
@@ -959,7 +959,7 @@ void developer_mode (lua_State *L) {
   nodelay(stdscr, 0);  /* make getch() block */
   int switch_to_big_picture_view = 1;
   if (editor_view_in_progress(L))
-    switch_to_big_picture_view = editor_view(L);
+    switch_to_big_picture_view = restore_editor_view(L);
   if (switch_to_big_picture_view)
     big_picture_view(L);
   cleanup_curses();