From 2e116251e2667b817646449a69621587b57aee89 Mon Sep 17 00:00:00 2001 From: Alan Kilborn Date: Wed, 12 Jun 2024 20:13:31 -0400 Subject: [PATCH] Fix the Begin/End Select after deletion problem Fix #15221, close #15278 --- PowerEditor/src/ScintillaComponent/ScintillaEditView.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/PowerEditor/src/ScintillaComponent/ScintillaEditView.cpp b/PowerEditor/src/ScintillaComponent/ScintillaEditView.cpp index 748e22b5f..97819045b 100644 --- a/PowerEditor/src/ScintillaComponent/ScintillaEditView.cpp +++ b/PowerEditor/src/ScintillaComponent/ScintillaEditView.cpp @@ -2787,14 +2787,16 @@ void ScintillaEditView::addText(size_t length, const char *buf) void ScintillaEditView::beginOrEndSelect(bool isColumnMode) { + auto currPos = execute(SCI_GETCURRENTPOS); + if (_beginSelectPosition == -1) { - _beginSelectPosition = execute(SCI_GETCURRENTPOS); + _beginSelectPosition = currPos; } else { - execute(SCI_SETSELECTIONMODE, static_cast(isColumnMode ? SC_SEL_RECTANGLE : SC_SEL_STREAM)); - execute(SCI_SETANCHOR, static_cast(_beginSelectPosition)); + execute(SCI_CHANGESELECTIONMODE, static_cast(isColumnMode ? SC_SEL_RECTANGLE : SC_SEL_STREAM)); + execute(isColumnMode ? SCI_SETANCHOR : SCI_SETSEL, static_cast(_beginSelectPosition), static_cast(currPos)); _beginSelectPosition = -1; } }