Merge branch 'fix_shortcut_mapper_scintilla_shortcut' of https://github.com/molsonkiko/notepad-plus-plus into molsonkiko-fix_shortcut_mapper_scintilla_shortcut

This commit is contained in:
Don Ho 2024-02-23 19:46:27 +01:00
commit 27156bdf3c
2 changed files with 16 additions and 0 deletions

View File

@ -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();

View File

@ -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);