diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-07-10 18:08:46 +0300 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-07-10 18:08:46 +0300 |
commit | 4a0a7b481ba6b532b936506a829dc982075e3ab8 (patch) | |
tree | 3cceab88549a70abb1c1263ad949a014891a3ea2 /src | |
parent | 2d45e3486b7ce95e6abc10cc6f19bb00981661b7 (diff) |
Fixed input dialog closing accidentally
The input dialog shouldn't respond to the generic "cancel" command because that'll easily lead to loss of user-entered text.
"cancel" is emitted in many situations, including right before a context menu is opened.
Diffstat (limited to 'src')
-rw-r--r-- | src/ui/util.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/ui/util.c b/src/ui/util.c index 570bae85..5aea4f11 100644 --- a/src/ui/util.c +++ b/src/ui/util.c | |||
@@ -1183,7 +1183,7 @@ iBool valueInputHandler_(iWidget *dlg, const char *cmd) { | |||
1183 | } | 1183 | } |
1184 | return iFalse; | 1184 | return iFalse; |
1185 | } | 1185 | } |
1186 | else if (equal_Command(cmd, "cancel")) { | 1186 | else if (equal_Command(cmd, "valueinput.cancel")) { |
1187 | postCommandf_App("valueinput.cancelled id:%s", cstr_String(id_Widget(dlg))); | 1187 | postCommandf_App("valueinput.cancelled id:%s", cstr_String(id_Widget(dlg))); |
1188 | setId_Widget(dlg, ""); /* no further commands to emit */ | 1188 | setId_Widget(dlg, ""); /* no further commands to emit */ |
1189 | setupSheetTransition_Mobile(dlg, iFalse); | 1189 | setupSheetTransition_Mobile(dlg, iFalse); |
@@ -1301,7 +1301,8 @@ iWidget *makeValueInput_Widget(iWidget *parent, const iString *initialValue, con | |||
1301 | addChild_Widget( | 1301 | addChild_Widget( |
1302 | dlg, | 1302 | dlg, |
1303 | iClob(makeDialogButtons_Widget( | 1303 | iClob(makeDialogButtons_Widget( |
1304 | (iMenuItem[]){ { "${cancel}", 0, 0, NULL }, { acceptLabel, 0, 0, "valueinput.accept" } }, | 1304 | (iMenuItem[]){ { "${cancel}", SDLK_ESCAPE, 0, "valueinput.cancel" }, |
1305 | { acceptLabel, 0, 0, "valueinput.accept" } }, | ||
1305 | 2))); | 1306 | 2))); |
1306 | finalizeSheet_Mobile(dlg); | 1307 | finalizeSheet_Mobile(dlg); |
1307 | if (parent) { | 1308 | if (parent) { |