From 2fb8d7fc77da8f5b75427917bc3eff38469ca4aa Mon Sep 17 00:00:00 2001 From: Don Ho Date: Tue, 7 Nov 2023 03:17:01 +0100 Subject: [PATCH] Fix the shortcut bug (a regression) in commit e9c50ed Ref: https://github.com/notepad-plus-plus/notepad-plus-plus/commit/e9c50ed967fe44c758cd25c3907ef8aee37e6f05#commitcomment-131870570 --- PowerEditor/src/ScintillaComponent/ScintillaEditView.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/PowerEditor/src/ScintillaComponent/ScintillaEditView.cpp b/PowerEditor/src/ScintillaComponent/ScintillaEditView.cpp index 2422c76d7..2a272fb24 100644 --- a/PowerEditor/src/ScintillaComponent/ScintillaEditView.cpp +++ b/PowerEditor/src/ScintillaComponent/ScintillaEditView.cpp @@ -539,8 +539,10 @@ LRESULT ScintillaEditView::scintillaNew_Proc(HWND hwnd, UINT Message, WPARAM wPa { case VK_DELETE: { + SHORT ctrl = GetKeyState(VK_CONTROL); + SHORT alt = GetKeyState(VK_MENU); SHORT shift = GetKeyState(VK_SHIFT); - if (shift & 0x8000) + if ((shift & 0x8000) && !(ctrl & 0x8000) && !(alt & 0x8000)) { bool hasSelection = (execute(SCI_GETSELECTIONSTART) != execute(SCI_GETSELECTIONEND)); if (!hasSelection) @@ -556,7 +558,9 @@ LRESULT ScintillaEditView::scintillaNew_Proc(HWND hwnd, UINT Message, WPARAM wPa case 'X': { SHORT ctrl = GetKeyState(VK_CONTROL); - if (ctrl & 0x8000) + SHORT alt = GetKeyState(VK_MENU); + SHORT shift = GetKeyState(VK_SHIFT); + if ((ctrl & 0x8000) && !(alt & 0x8000) && !(shift & 0x8000)) { bool hasSelection = (execute(SCI_GETSELECTIONSTART) != execute(SCI_GETSELECTIONEND)); if (!hasSelection)