From: Holger Schemel Date: Fri, 16 Nov 2018 20:52:26 +0000 (+0100) Subject: added deactivating text (and selectbox) gadgets with "Escape" key X-Git-Tag: 4.1.2.0~95 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=3bb0d9d605aafe3e832aa79fa9e8c7f088556819;p=rocksndiamonds.git added deactivating text (and selectbox) gadgets with "Escape" key --- 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 {