fix: AllowWhileTyping shortcuts only working while typing
This commit is contained in:
parent
4a916ebb89
commit
185a593bc2
@ -309,21 +309,27 @@ namespace hex {
|
|||||||
pressedShortcut += s_macOSMode ? CTRLCMD : SUPER;
|
pressedShortcut += s_macOSMode ? CTRLCMD : SUPER;
|
||||||
if (focused)
|
if (focused)
|
||||||
pressedShortcut += CurrentView;
|
pressedShortcut += CurrentView;
|
||||||
if (ImGui::GetIO().WantTextInput)
|
|
||||||
pressedShortcut += AllowWhileTyping;
|
|
||||||
|
|
||||||
pressedShortcut += static_cast<Keys>(keyCode);
|
pressedShortcut += static_cast<Keys>(keyCode);
|
||||||
|
|
||||||
return pressedShortcut;
|
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 (s_paused) return;
|
||||||
|
|
||||||
if (ImGui::IsPopupOpen(ImGuiID(0), ImGuiPopupFlags_AnyPopupId))
|
if (ImGui::IsPopupOpen(ImGuiID(0), ImGuiPopupFlags_AnyPopupId))
|
||||||
return;
|
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;
|
const auto &[foundShortcut, entry] = *it;
|
||||||
|
|
||||||
if (entry.enabledCallback()) {
|
if (entry.enabledCallback()) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user