about summary refs log tree commit diff stats
path: root/src/teliva.c
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2022-01-25 21:42:31 -0800
committerKartik K. Agaram <vc@akkartik.com>2022-01-25 21:44:01 -0800
commit91d47faf233c0b463a34ca9de507b9fd4adf4011 (patch)
treea4468fe138fa1351b0bd4a05d7075837698c153e /src/teliva.c
parent84d76b11fa7422d85615d7df0b218359569eae34 (diff)
downloadteliva-91d47faf233c0b463a34ca9de507b9fd4adf4011.tar.gz
disable Lua colors in prose
Diffstat (limited to 'src/teliva.c')
-rw-r--r--src/teliva.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/teliva.c b/src/teliva.c
index 8d34754..7e769c9 100644
--- a/src/teliva.c
+++ b/src/teliva.c
@@ -667,6 +667,7 @@ void draw_callers_of_current_definition(lua_State* L) {
 
 extern int resumeEdit(lua_State* L);
 extern int editFrom(lua_State* L, char* filename, int rowoff, int coloff, int cy, int cx);
+extern int editProseFrom(lua_State* L, char* filename, int rowoff, int coloff, int cy, int cx);
 int restore_editor_view(lua_State* L) {
   lua_getglobal(L, "__teliva_editor_state");
   int editor_state_index = lua_gettop(L);
@@ -682,11 +683,12 @@ int restore_editor_view(lua_State* L) {
   lua_getfield(L, editor_state_index, "cx");
   int cx = lua_tointeger(L, -1);
   lua_settop(L, editor_state_index);
-  int back_to_big_picture = editFrom(L, "teliva_editor_buffer", rowoff, coloff, cy, cx);
   if (starts_with(Current_definition, "doc:")) {
+    int back_to_big_picture = editProseFrom(L, "teliva_editor_buffer", rowoff, coloff, cy, cx);
     load_editor_buffer_to_current_definition_in_image(L);
     return back_to_big_picture;
   }
+  int back_to_big_picture = editFrom(L, "teliva_editor_buffer", rowoff, coloff, cy, cx);
   // error handling
   int oldtop = lua_gettop(L);
   while (1) {
@@ -868,12 +870,14 @@ int load_editor_buffer_to_current_definition_in_image_and_reload(lua_State* L) {
 /* return true if user chose to back into the big picture view */
 /* But only if there are no errors. Otherwise things can get confusing. */
 extern int edit(lua_State* L, char* filename);
+extern int editProse(lua_State* L, char* filename);
 static int edit_current_definition(lua_State* L) {
-  int back_to_big_picture = edit(L, "teliva_editor_buffer");
   if (starts_with(Current_definition, "doc:")) {
+    int back_to_big_picture = editProse(L, "teliva_editor_buffer");
     load_editor_buffer_to_current_definition_in_image(L);
     return back_to_big_picture;
   }
+  int back_to_big_picture = edit(L, "teliva_editor_buffer");
   // error handling
   int oldtop = lua_gettop(L);
   while (1) {