From: terencehill Date: Tue, 7 Mar 2023 11:15:38 +0000 (+0100) Subject: Keybinder: make sure the selected keybind is always visible when user clicks a button... X-Git-Tag: xonotic-v0.8.6~157 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=67cac2f5fc63bce16cb9e17a63ee24a46425847c;p=xonotic%2Fxonotic-data.pk3dir.git Keybinder: make sure the selected keybind is always visible when user clicks a button to edit it --- diff --git a/qcsrc/menu/xonotic/keybinder.qc b/qcsrc/menu/xonotic/keybinder.qc index 5a0f9f487..6d0004151 100644 --- a/qcsrc/menu/xonotic/keybinder.qc +++ b/qcsrc/menu/xonotic/keybinder.qc @@ -208,6 +208,7 @@ void KeyBinder_Bind_Change(entity btn, entity me) if(func == "" || KEYBIND_IS_SPECIAL(func)) return; + me.setSelected(me, me.selectedItem); // make it visible if it's hidden me.keyGrabButton.forcePressed = 1; me.clearButton.disabled = 1; keyGrabber = me; @@ -302,6 +303,8 @@ void KeyBinder_Bind_Edit(entity btn, entity me) string descr = KeyBinds_Descriptions[me.selectedItem]; if(substring(descr, 0, 1) != "$") return; + + me.setSelected(me, me.selectedItem); // make it visible if it's hidden descr = substring(descr, 1, strlen(descr) - 1); // Hooray! It IS a user bind! @@ -317,6 +320,8 @@ void KeyBinder_Bind_Clear(entity btn, entity me) if(func == "" || KEYBIND_IS_SPECIAL(func)) return; + me.setSelected(me, me.selectedItem); // make it visible if it's hidden + n = tokenize(findkeysforcommand(func, 0)); // uses '...' strings for(j = 0; j < n; ++j) {