diff options
| author | Vaxry <43317083+vaxerski@users.noreply.github.com> | 2026-04-29 13:41:09 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-04-29 13:41:09 +0100 |
| commit | 342750b56f5f481404f746fe3149fe2199761865 (patch) | |
| tree | 38335b0417925eafc440f81dd8ffe8e4caf8e3f7 /src/managers/KeybindManager.cpp | |
| parent | e61976233e01446c4e7dd4fa3b4209fea1fca9ed (diff) | |
config/lua: fix unbind behavior (#14199)
Diffstat (limited to 'src/managers/KeybindManager.cpp')
| -rw-r--r-- | src/managers/KeybindManager.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/managers/KeybindManager.cpp b/src/managers/KeybindManager.cpp index 28c57eb9..8b1ec653 100644 --- a/src/managers/KeybindManager.cpp +++ b/src/managers/KeybindManager.cpp @@ -197,6 +197,23 @@ void CKeybindManager::removeKeybind(uint32_t mod, const SParsedKey& key) { m_lastLongPressKeybind.reset(); } +void CKeybindManager::removeKeybind(const std::string& displayKeys) { + static auto normalize = [](std::string x) -> std::string { + std::string n = x; + replaceInString(n, " ", ""); + std::ranges::transform(n, n.begin(), ::tolower); + return n; + }; + + const auto DISPLAY_KEYS_NORMALIZED = normalize(displayKeys); + + std::erase_if(m_keybinds, + [&displayKeys, &DISPLAY_KEYS_NORMALIZED](const auto& el) { return el->displayKey == displayKeys || DISPLAY_KEYS_NORMALIZED == normalize(el->displayKey); }); + + m_activeKeybinds.clear(); + m_lastLongPressKeybind.reset(); +} + uint32_t CKeybindManager::stringToModMask(std::string mods) { uint32_t modMask = 0; std::ranges::transform(mods, mods.begin(), ::toupper); |
