shithub: orca

Download patch

ref: 09f7249c732554627dd9fb6fdbb4528998821ef3
parent: a72e0d3495d152718c3643804fb3455a6cbf0e3a
author: cancel <cancel@cancel.fm>
date: Sun Jan 26 17:47:35 EST 2020

Cleanup

--- a/tui_main.c
+++ b/tui_main.c
@@ -2886,6 +2886,13 @@
                       t->softmargin_x);
 }
 
+static void tui_try_save(Tui *t) {
+  if (osolen(t->file_name) > 0)
+    try_save_with_msg(&t->ged.field, t->file_name);
+  else
+    push_save_as_form("");
+}
+
 typedef enum {
   Tui_menus_nothing = 0,
   Tui_menus_quit,
@@ -2957,11 +2964,7 @@
           push_open_form(osoc(t->file_name));
           break;
         case Main_menu_save:
-          if (osolen(t->file_name) > 0) {
-            try_save_with_msg(&t->ged.field, t->file_name);
-          } else {
-            push_save_as_form("");
-          }
+          tui_try_save(t);
           break;
         case Main_menu_save_as:
           push_save_as_form(osoc(t->file_name));
@@ -3948,12 +3951,7 @@
     push_opers_guide_msg();
     break;
   case CTRL_PLUS('s'):
-    // TODO duplicated with menu item code
-    if (osolen(t.file_name) > 0) {
-      try_save_with_msg(&t.ged.field, t.file_name);
-    } else {
-      push_save_as_form("");
-    }
+    tui_try_save(&t);
     break;
 
   default: