From 359436da6f0d9bb2e45abe4ac71cfb4b30a92dcf Mon Sep 17 00:00:00 2001 From: Robert Burnham Date: Mon, 20 Jul 2026 14:39:09 -0500 Subject: [PATCH] Fix `/unbind` for keychains `/unbind` couldn't handle chained keysets: bind accepts "a,b" but unbind parsed the key string as a single keyset, so unbinding a keychain always failed with "could not parse key". This parses the key string with the same keychain parser bind uses and looks the binding up under the chain's last keyset, which is where bind stores it. Removal matching is unchanged. --- rts/Game/UI/KeyBindings.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/rts/Game/UI/KeyBindings.cpp b/rts/Game/UI/KeyBindings.cpp index 4dd9e09711..bde8e3efb1 100644 --- a/rts/Game/UI/KeyBindings.cpp +++ b/rts/Game/UI/KeyBindings.cpp @@ -662,8 +662,8 @@ bool CKeyBindings::Bind(const std::string& keystr, const std::string& line) bool CKeyBindings::UnBind(const std::string& keystr, const std::string& command) { RECOIL_DETAILED_TRACY_ZONE; - CKeySet ks; - if (!ks.Parse(keystr)) { + CKeyChain kc; + if (!ParseKeyChain(keystr, &kc) || kc.empty()) { LOG_L(L_WARNING, "UnBind: could not parse key: %s", keystr.c_str()); return false; } @@ -671,6 +671,7 @@ bool CKeyBindings::UnBind(const std::string& keystr, const std::string& command) if (debugEnabled) LOG("[CKeyBindings::%s] keystr=%s command=%s", __func__, keystr.c_str(), command.c_str()); + const CKeySet& ks = kc.back(); KeyMap& bindings = ks.IsKeyCode() ? codeBindings : scanBindings; const auto it = bindings.find(ks);