diff --git a/PowerEditor/src/WinControls/Grid/ShortcutMapper.cpp b/PowerEditor/src/WinControls/Grid/ShortcutMapper.cpp index d7fa6640d..263a53174 100644 --- a/PowerEditor/src/WinControls/Grid/ShortcutMapper.cpp +++ b/PowerEditor/src/WinControls/Grid/ShortcutMapper.cpp @@ -222,6 +222,21 @@ bool ShortcutMapper::isFilterValid(PluginCmdShortcut sc) return match; } +bool ShortcutMapper::isFilterValid(ScintillaKeyMap sc) +{ + // do a classic search on shortcut name, + // then see if the list of keycombos matches (e.g. "Ctrl+X or Alt+Y" matches "or" and "Alt" and "Ctrl+") + if (_shortcutFilter.empty()) + return true; + + wstring shortcut_name = stringToLower(string2wstring(sc.getName(), CP_UTF8)); + if (shortcut_name.find(_shortcutFilter) != std::string::npos) + return true; // name matches + + wstring shortcut_value = stringToLower(string2wstring(sc.toString(), CP_UTF8)); + return shortcut_value.find(_shortcutFilter) != std::string::npos; // list of shortcuts matches +} + void ShortcutMapper::fillOutBabyGrid() { NppParameters& nppParam = NppParameters::getInstance(); diff --git a/PowerEditor/src/WinControls/Grid/ShortcutMapper.h b/PowerEditor/src/WinControls/Grid/ShortcutMapper.h index a96f02907..cad79cf91 100644 --- a/PowerEditor/src/WinControls/Grid/ShortcutMapper.h +++ b/PowerEditor/src/WinControls/Grid/ShortcutMapper.h @@ -57,6 +57,7 @@ public: generic_string getTextFromCombo(HWND hCombo); bool isFilterValid(Shortcut); bool isFilterValid(PluginCmdShortcut sc); + bool isFilterValid(ScintillaKeyMap sc); protected : intptr_t CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam);