shithub: orca

Download patch

ref: 1f2c2cfc784cc2e1d55d3cc197fc2101ab00118c
parent: 783280ffd72414d2fa6bc23ec285153c1b54f7d6
author: cancel <cancel@cancel.fm>
date: Mon Dec 17 22:39:04 EST 2018

Add more form stuff

--- a/term_util.c
+++ b/term_util.c
@@ -356,6 +356,21 @@
     out_action->any.type = Qform_action_type_canceled;
     return true;
   }
+  case CTRL_PLUS('a'):
+    form_driver(qf->ncurses_form, REQ_BEG_LINE);
+    return false;
+  case CTRL_PLUS('e'):
+    form_driver(qf->ncurses_form, REQ_END_LINE);
+    return false;
+  case CTRL_PLUS('b'):
+    form_driver(qf->ncurses_form, REQ_PREV_CHAR);
+    return false;
+  case CTRL_PLUS('f'):
+    form_driver(qf->ncurses_form, REQ_NEXT_CHAR);
+    return false;
+  case CTRL_PLUS('k'):
+    form_driver(qf->ncurses_form, REQ_CLR_EOL);
+    return false;
   case KEY_RIGHT:
     form_driver(qf->ncurses_form, REQ_RIGHT_CHAR);
     return false;
--- a/tui_main.c
+++ b/tui_main.c
@@ -1489,6 +1489,10 @@
 };
 
 enum {
+  Save_as_name_id = 1,
+};
+
+enum {
   Main_menu_quit = 1,
   Main_menu_controls,
   Main_menu_save,
@@ -1632,10 +1636,10 @@
   }
 }
 
-void push_save_as_form(void) {
+void push_save_as_form(char const* initial) {
   Qform* qf = qform_create(Save_as_form_id);
   qform_set_title(qf, "Save As");
-  qform_add_text_line(qf, 0, "file name");
+  qform_add_text_line(qf, Save_as_name_id, initial);
   qform_push_to_nav(qf);
 }
 
@@ -1958,7 +1962,7 @@
                 try_save_with_msg(&ged_state);
                 break;
               case Main_menu_save_as:
-                push_save_as_form();
+                push_save_as_form(ged_state.filename);
                 break;
               }
             }