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; } }