From 67cac2f5fc63bce16cb9e17a63ee24a46425847c Mon Sep 17 00:00:00 2001 From: terencehill Date: Tue, 7 Mar 2023 12:15:38 +0100 Subject: [PATCH] Keybinder: make sure the selected keybind is always visible when user clicks a button to edit it --- qcsrc/menu/xonotic/keybinder.qc | 5 +++++ 1 file changed, 5 insertions(+) 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) { -- 2.39.2