1
0
mirror of synced 2025-02-02 04:17:56 +01:00

fix: AllowWhileTyping shortcuts only working while typing

This commit is contained in:
WerWolv 2025-01-14 17:50:06 +01:00
parent 4a916ebb89
commit 185a593bc2

View File

@ -309,21 +309,27 @@ namespace hex {
pressedShortcut += s_macOSMode ? CTRLCMD : SUPER;
if (focused)
pressedShortcut += CurrentView;
if (ImGui::GetIO().WantTextInput)
pressedShortcut += AllowWhileTyping;
pressedShortcut += static_cast<Keys>(keyCode);
return pressedShortcut;
}
static void processShortcut(const Shortcut &shortcut, const std::map<Shortcut, ShortcutManager::ShortcutEntry> &shortcuts) {
static void processShortcut(Shortcut shortcut, const std::map<Shortcut, ShortcutManager::ShortcutEntry> &shortcuts) {
if (s_paused) return;
if (ImGui::IsPopupOpen(ImGuiID(0), ImGuiPopupFlags_AnyPopupId))
return;
if (auto it = shortcuts.find(shortcut); it != shortcuts.end()) {
const bool currentlyTyping = ImGui::GetIO().WantTextInput;
auto it = shortcuts.find(shortcut + AllowWhileTyping);
if (!currentlyTyping && it == shortcuts.end()) {
if (it == shortcuts.end())
it = shortcuts.find(shortcut);
}
if (it != shortcuts.end()) {
const auto &[foundShortcut, entry] = *it;
if (entry.enabledCallback()) {