From 7083b6ab3e564a6e21f3e035ce0b72499c8edd48 Mon Sep 17 00:00:00 2001 From: WerWolv Date: Sat, 14 Mar 2026 17:19:27 +0100 Subject: [PATCH] impr: Recursively trigger inherited view shortcuts --- lib/libimhex/source/api/shortcut_manager.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) 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; } }