From a44de1596dce610e010040ae9f61f0bde10a8965 Mon Sep 17 00:00:00 2001 From: Yamagi Date: Sun, 4 Sep 2022 18:18:58 +0200 Subject: [PATCH] Fix spin controls getting applied multiple times. When a spin control is at min or max value, pressing the arrow key to switch to the next nonexiting value executes the callback function. That is confusing. Example: 'freelook' is set to 'no'. The user presses left arrow, switching to the nonexiting value before no. The code handles the case and resets the current value drom -1 to 0. Nevertheless the callback is executed and switches 'freelook' from no to yes... Fix that by not executing the callback when we're at min or max value. Closes #884. --- src/client/menu/qmenu.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/client/menu/qmenu.c b/src/client/menu/qmenu.c index ad5e35c0..d5c4f20c 100644 --- a/src/client/menu/qmenu.c +++ b/src/client/menu/qmenu.c @@ -729,10 +729,12 @@ SpinControl_DoSlide(menulist_s *s, int dir) if (s->curvalue < 0) { s->curvalue = 0; + return; } else if (s->itemnames[s->curvalue] == 0) { s->curvalue--; + return; } if (s->generic.callback)