Lagrange [work/v1.11]

Save text entered in the input prompt

=> bbd7c82c7da273408ea965a9db368a35f8236943

diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c
index 1f3e0e37..7c071f47 100644
--- a/src/ui/documentwidget.c
+++ b/src/ui/documentwidget.c
@@ -3273,9 +3273,11 @@ static void checkResponse_DocumentWidget_(iDocumentWidget *d) {
                         setTextColor_LabelWidget(menu, uiTextAction_ColorId);
                     }
                 }
-                setValidator_InputWidget(findChild_Widget(dlg, "input"), inputQueryValidator_, d);
-                setSensitiveContent_InputWidget(findChild_Widget(dlg, "input"),
-                                                statusCode == sensitiveInput_GmStatusCode);
+                iInputWidget *input = findChild_Widget(dlg, "input");
+                setValidator_InputWidget(input, inputQueryValidator_, d);
+                setBackupFileName_InputWidget(input, "inputbackup.txt");
+                setSelectAllOnFocus_InputWidget(input, iTrue);
+                setSensitiveContent_InputWidget(input, statusCode == sensitiveInput_GmStatusCode);
                 if (document_App() != d) {
                     postCommandf_App("tabs.switch page:%p", d);
                 }
diff --git a/src/ui/inputwidget.c b/src/ui/inputwidget.c
index 6a8d428a..1b68ff57 100644
--- a/src/ui/inputwidget.c
+++ b/src/ui/inputwidget.c
@@ -1201,6 +1201,11 @@ void selectAll_InputWidget(iInputWidget *d) {
 #endif
 }
 
+void deselect_InputWidget(iInputWidget *d) {
+    iZap(d->mark);
+    refresh_Widget(as_Widget(d));
+}
+
 void validate_InputWidget(iInputWidget *d) {
     if (d->validator) {
         d->validator(d, d->validatorContext); /* this may change the contents */
diff --git a/src/ui/inputwidget.h b/src/ui/inputwidget.h
index 000fa4b7..832f7853 100644
--- a/src/ui/inputwidget.h
+++ b/src/ui/inputwidget.h
@@ -59,6 +59,7 @@ void    setBackupFileName_InputWidget   (iInputWidget *, const char *fileName);
 void    begin_InputWidget               (iInputWidget *);
 void    end_InputWidget                 (iInputWidget *, iBool accept);
 void    selectAll_InputWidget           (iInputWidget *);
+void    deselect_InputWidget            (iInputWidget *);
 void    validate_InputWidget            (iInputWidget *);
 
 void    setSelectAllOnFocus_InputWidget (iInputWidget *, iBool selectAllOnFocus);
diff --git a/src/ui/util.c b/src/ui/util.c
index 94e4b00c..de755b3f 100644
--- a/src/ui/util.c
+++ b/src/ui/util.c
@@ -1712,13 +1712,14 @@ iLabelWidget *addDialogTitle_Widget(iWidget *dlg, const char *text, const char *
 }
 
 static void acceptValueInput_(iWidget *dlg) {
-    const iInputWidget *input = findChild_Widget(dlg, "input");
+    iInputWidget *input = findChild_Widget(dlg, "input");
     if (!isEmpty_String(id_Widget(dlg))) {
         const iString *val = text_InputWidget(input);
         postCommandf_App("%s arg:%d value:%s",
                          cstr_String(id_Widget(dlg)),
                          toInt_String(val),
                          cstr_String(val));
+        setBackupFileName_InputWidget(input, NULL);
     }
 }
 
@@ -1782,6 +1783,7 @@ iBool valueInputHandler_(iWidget *dlg, const char *cmd) {
     else if (equal_Command(cmd, "valueinput.set")) {
         iInputWidget *input = findChild_Widget(dlg, "input");
         setTextUndoableCStr_InputWidget(input, suffixPtr_Command(cmd, "text"), iTrue);
+        deselect_InputWidget(input);
         validate_InputWidget(input);
         return iTrue;
     }
Proxy Information
Original URL
gemini://git.skyjake.fi/lagrange/work%2Fv1.11/cdiff/bbd7c82c7da273408ea965a9db368a35f8236943
Status Code
Success (20)
Meta
text/gemini; charset=utf-8
Capsule Response Time
69.138307 milliseconds
Gemini-to-HTML Time
0.218829 milliseconds

This content has been proxied by September (ba2dc).