diff --git a/lib/libimhex/source/api/shortcut_manager.cpp b/lib/libimhex/source/api/shortcut_manager.cpp index 8bf8b615c..8896d89fb 100644 --- a/lib/libimhex/source/api/shortcut_manager.cpp +++ b/lib/libimhex/source/api/shortcut_manager.cpp @@ -367,10 +367,16 @@ namespace hex { if (keyCode != 0) s_prevShortcut = Shortcut(pressedShortcut.getKeys()); - const auto inheritedShortcutsView = currentView->getMenuItemInheritView(); - if (!runShortcut(pressedShortcut, currentView)) { - if (inheritedShortcutsView != nullptr) - runShortcut(pressedShortcut, inheritedShortcutsView); + std::set processedViews; + while (true) { + if (runShortcut(pressedShortcut, currentView)) { + break; + } + + processedViews.insert(currentView); + currentView = currentView->getMenuItemInheritView(); + if (currentView == nullptr || processedViews.contains(currentView)) + break; } }