From c551e955e94ccf1fb7cb5a1df9d8572a39f6f3d1 Mon Sep 17 00:00:00 2001 From: scheffle Date: Thu, 31 Oct 2024 11:08:44 +0100 Subject: [PATCH] fix selection after shifting when the selection started at the beginning of a line --- vstgui/lib/ctexteditor.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/vstgui/lib/ctexteditor.cpp b/vstgui/lib/ctexteditor.cpp index e65c24c37..7fc912e3f 100644 --- a/vstgui/lib/ctexteditor.cpp +++ b/vstgui/lib/ctexteditor.cpp @@ -2163,7 +2163,6 @@ bool TextEditorView::doShifting (bool right) const } md.editState.select_start = originSelectStart + 1; md.editState.select_end = originSelectEnd + numChanges; - md.editState.cursor = md.editState.select_start; } else { @@ -2181,8 +2180,14 @@ bool TextEditorView::doShifting (bool right) const } md.editState.select_start = originSelectStart - (numChanges ? 1 : 0); md.editState.select_end = originSelectEnd - numChanges; - md.editState.cursor = md.editState.select_start; } + if (hasSelection) + { + if (originSelectStart == lineStart->range.start) + md.editState.select_start = originSelectStart; + } + + md.editState.cursor = md.editState.select_start; onCursorChanged (originCursor, md.editState.cursor); onSelectionChanged (makeRange (md.editState)); return true;