From 3bb0d9d605aafe3e832aa79fa9e8c7f088556819 Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Fri, 16 Nov 2018 21:52:26 +0100 Subject: [PATCH] added deactivating text (and selectbox) gadgets with "Escape" key --- src/libgame/gadgets.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/libgame/gadgets.c b/src/libgame/gadgets.c index 4b237b88..0295eec6 100644 --- a/src/libgame/gadgets.c +++ b/src/libgame/gadgets.c @@ -2117,7 +2117,18 @@ boolean HandleGadgetsKeyInput(Key key) if (key == KSYM_Escape) { - StopTextInput(); + if (anyTextGadgetActive()) + { + // restore previous text (before activating text gadget) + if (gi->type & GD_TYPE_TEXT_INPUT) + strcpy(gi->textinput.value, gi->textinput.last_value); + + DrawGadget(gi, DG_UNPRESSED, gi->direct_draw); + + last_gi = NULL; + + StopTextInput(); + } } else if (key == KSYM_Return) // valid for both text input and selectbox { -- 2.34.1