From 4a0a7b481ba6b532b936506a829dc982075e3ab8 Mon Sep 17 00:00:00 2001 From: Jaakko Keränen Date: Sat, 10 Jul 2021 18:08:46 +0300 Subject: 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. --- src/ui/util.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/ui/util.c') 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) { } return iFalse; } - else if (equal_Command(cmd, "cancel")) { + else if (equal_Command(cmd, "valueinput.cancel")) { postCommandf_App("valueinput.cancelled id:%s", cstr_String(id_Widget(dlg))); setId_Widget(dlg, ""); /* no further commands to emit */ setupSheetTransition_Mobile(dlg, iFalse); @@ -1301,7 +1301,8 @@ iWidget *makeValueInput_Widget(iWidget *parent, const iString *initialValue, con addChild_Widget( dlg, iClob(makeDialogButtons_Widget( - (iMenuItem[]){ { "${cancel}", 0, 0, NULL }, { acceptLabel, 0, 0, "valueinput.accept" } }, + (iMenuItem[]){ { "${cancel}", SDLK_ESCAPE, 0, "valueinput.cancel" }, + { acceptLabel, 0, 0, "valueinput.accept" } }, 2))); finalizeSheet_Mobile(dlg); if (parent) { -- cgit v1.2.3