From: Holger Schemel Date: Thu, 22 Oct 2020 16:25:15 +0000 (+0200) Subject: fixed bug with text input gadgets when pressing "Escape" key X-Git-Tag: 4.2.0.4~11 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=0865ed73513e161be429a61c63913d58c9d145a3;p=rocksndiamonds.git fixed bug with text input gadgets when pressing "Escape" key This bugs happens when incrementing or decrementing a numeric text input gadget by 5 or 10 (using middle or right mouse button) so that it gets a value beyond the allowed range. Although this will be corrected, the "last value" variable still has the bad value, which gets restored when clicking that text input gadget and then leaving it by pressing the "Escape" key. --- diff --git a/src/libgame/gadgets.c b/src/libgame/gadgets.c index 56c359bc..f84815b0 100644 --- a/src/libgame/gadgets.c +++ b/src/libgame/gadgets.c @@ -2230,8 +2230,12 @@ boolean HandleGadgetsKeyInput(Key key) { // restore previous text (before activating text gadget) if (gi->type & GD_TYPE_TEXT_INPUT) + { strcpy(gi->textinput.value, gi->textinput.last_value); + CheckRangeOfNumericInputGadget(gi); + } + DrawGadget(gi, DG_UNPRESSED, gi->direct_draw); last_gi = NULL;