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
This commit is contained in:
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 ShortcutMapper::isFilterValid(Shortcut sc)
{ {
bool match = false;
generic_string shortcut_name = stringToLower(generic_string(sc.getName()));
if (_shortcutFilter.empty()) if (_shortcutFilter.empty())
{
return true; return true;
}
// test the filter on the shortcut name generic_string shortcut_name = stringToLower(generic_string(sc.getName()));
size_t match_pos = shortcut_name.find(_shortcutFilter); generic_string shortcut_value = stringToLower(sc.toString());
if (match_pos != std::string::npos){
match = true; // test the filter on the shortcut name and value
} return (shortcut_name.find(_shortcutFilter) != std::string::npos) ||
return match; (shortcut_value.find(_shortcutFilter) != std::string::npos);
} }
bool ShortcutMapper::isFilterValid(PluginCmdShortcut sc) bool ShortcutMapper::isFilterValid(PluginCmdShortcut sc)