Add filter capacity in Shortcut mapper by shortcut key combination

This allows to filter shortcuts in Shortcut mapper not only by name but also by key combination text.

Fix #5616, fix #9316, close #10192
pull/10234/head
Vitaliy Grabchuk 2021-07-19 15:34:33 +03:00 committed by Don Ho
parent 50dfdb2a8d
commit 3482673fd8
1 changed files with 7 additions and 10 deletions

View File

@ -141,18 +141,15 @@ generic_string ShortcutMapper::getTextFromCombo(HWND hCombo)
bool ShortcutMapper::isFilterValid(Shortcut sc)
{
bool match = false;
generic_string shortcut_name = stringToLower(generic_string(sc.getName()));
if (_shortcutFilter.empty())
{
return true;
}
// test the filter on the shortcut name
size_t match_pos = shortcut_name.find(_shortcutFilter);
if (match_pos != std::string::npos){
match = true;
}
return match;
generic_string shortcut_name = stringToLower(generic_string(sc.getName()));
generic_string shortcut_value = stringToLower(sc.toString());
// test the filter on the shortcut name and value
return (shortcut_name.find(_shortcutFilter) != std::string::npos) ||
(shortcut_value.find(_shortcutFilter) != std::string::npos);
}
bool ShortcutMapper::isFilterValid(PluginCmdShortcut sc)