Skip to content

Commit 7083b6a

Browse files
committed
impr: Recursively trigger inherited view shortcuts
1 parent 432e16e commit 7083b6a

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

lib/libimhex/source/api/shortcut_manager.cpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -367,10 +367,16 @@ namespace hex {
367367
if (keyCode != 0)
368368
s_prevShortcut = Shortcut(pressedShortcut.getKeys());
369369

370-
const auto inheritedShortcutsView = currentView->getMenuItemInheritView();
371-
if (!runShortcut(pressedShortcut, currentView)) {
372-
if (inheritedShortcutsView != nullptr)
373-
runShortcut(pressedShortcut, inheritedShortcutsView);
370+
std::set<const View*> processedViews;
371+
while (true) {
372+
if (runShortcut(pressedShortcut, currentView)) {
373+
break;
374+
}
375+
376+
processedViews.insert(currentView);
377+
currentView = currentView->getMenuItemInheritView();
378+
if (currentView == nullptr || processedViews.contains(currentView))
379+
break;
374380
}
375381
}
376382

0 commit comments

Comments
 (0)