From 3482673fd8cdf5d15f365470c4a12a3fd7feae5f Mon Sep 17 00:00:00 2001 From: Vitaliy Grabchuk Date: Mon, 19 Jul 2021 15:34:33 +0300 Subject: [PATCH] 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 --- .../src/WinControls/Grid/ShortcutMapper.cpp | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/PowerEditor/src/WinControls/Grid/ShortcutMapper.cpp b/PowerEditor/src/WinControls/Grid/ShortcutMapper.cpp index 980ea3187..0f59a7658 100644 --- a/PowerEditor/src/WinControls/Grid/ShortcutMapper.cpp +++ b/PowerEditor/src/WinControls/Grid/ShortcutMapper.cpp @@ -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)