From aad331f1bee2ac733b14b23a3eda6eeae2757fb7 Mon Sep 17 00:00:00 2001 From: Rainer Kottenhoff Date: Tue, 22 Aug 2017 22:53:00 +0200 Subject: [PATCH] + fix: undo destructive operation on selection (rectangle) does not restore selection or preserves selection mode (extends selection on caret movement) -> need to send SCI_CANCEL at the end of restored selection --- src/Notepad3.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Notepad3.c b/src/Notepad3.c index 92bc73c16..90fafbace 100644 --- a/src/Notepad3.c +++ b/src/Notepad3.c @@ -7073,7 +7073,6 @@ void RestoreSelectionAction(int token) UndoRedoSelection sel = { -1,-1,-1 }; if (UndoSelectionMap(token, &sel) >= 0) { // we are inside undo transaction, so do delayed PostMessage() instead of SendMessage() - int currSelMode = (int)SendMessage(hwndEdit, SCI_GETSELECTIONMODE, 0, 0); PostMessage(hwndEdit, SCI_SETSELECTIONMODE, (WPARAM)sel.selMode, 0); if (sel.selMode == SC_SEL_RECTANGLE) { @@ -7083,7 +7082,7 @@ void RestoreSelectionAction(int token) else { PostMessage(hwndEdit, SCI_SETSELECTION, (WPARAM)sel.currPos, (LPARAM)sel.anchorPos); } - PostMessage(hwndEdit, SCI_SETSELECTIONMODE, (WPARAM)currSelMode, 0); + PostMessage(hwndEdit, SCI_CANCEL, 0, 0); } }