From 14a104ad4691f99ebc6c99ab533686e0e5f0758f Mon Sep 17 00:00:00 2001 From: Don Ho Date: Tue, 3 Aug 2021 20:56:29 +0200 Subject: [PATCH] Fix shortcut conflict detection error in shortcut mapper https://github.com/notepad-plus-plus/notepad-plus-plus/issues/5374#issuecomment-891879420 Fix #5374 --- PowerEditor/src/WinControls/Grid/ShortcutMapper.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/PowerEditor/src/WinControls/Grid/ShortcutMapper.cpp b/PowerEditor/src/WinControls/Grid/ShortcutMapper.cpp index f650ee433..bcb551594 100644 --- a/PowerEditor/src/WinControls/Grid/ShortcutMapper.cpp +++ b/PowerEditor/src/WinControls/Grid/ShortcutMapper.cpp @@ -552,7 +552,10 @@ INT_PTR CALLBACK ShortcutMapper::run_dlgProc(UINT message, WPARAM wParam, LPARAM generic_string conflictInfo; - const bool isConflict = findKeyConflicts(&conflictInfo, *reinterpret_cast(wParam), _babygrid.getSelectedRow() - 1); + // In case of using filter will make the filtered items change index, so here we get its real index + size_t realIndexOfSelectedItem = _shortcutIndex[_babygrid.getSelectedRow() - 1]; + + const bool isConflict = findKeyConflicts(&conflictInfo, *reinterpret_cast(wParam), realIndexOfSelectedItem); *reinterpret_cast(lParam) = isConflict; if (isConflict)