fix(chat): suppress alnum hotkeys while typing

This commit is contained in:
Kelsi 2026-03-14 03:54:26 -07:00
parent 14e58eaa01
commit a5b877de67
2 changed files with 28 additions and 15 deletions

View file

@ -42,7 +42,19 @@ void KeybindingManager::initializeDefaults() {
bool KeybindingManager::isActionPressed(Action action, bool repeat) {
auto it = bindings_.find(static_cast<int>(action));
if (it == bindings_.end()) return false;
return ImGui::IsKeyPressed(it->second, repeat);
ImGuiKey key = it->second;
if (key == ImGuiKey_None) return false;
// When typing in a text field (e.g. chat input), never treat A-Z or 0-9 as shortcuts.
const ImGuiIO& io = ImGui::GetIO();
if (io.WantTextInput) {
if ((key >= ImGuiKey_A && key <= ImGuiKey_Z) ||
(key >= ImGuiKey_0 && key <= ImGuiKey_9)) {
return false;
}
}
return ImGui::IsKeyPressed(key, repeat);
}
ImGuiKey KeybindingManager::getKeyForAction(Action action) const {