From c2fed374732bfece2e47c759f7d74b35bf743481 Mon Sep 17 00:00:00 2001 From: Neil Date: Sat, 9 Feb 2019 19:54:22 +1100 Subject: Backport: Bug [#2078]. Fix garbage text from SCI_MOVESELECTEDLINESUP and SCI_MOVESELECTEDLINESDOWN for rectangular or thin selection by performing no action. Backport of changeset 7251:df5c32512d3d. --- src/Editor.cxx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/Editor.cxx b/src/Editor.cxx index e6a1637f9..fd21e47bb 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -1002,6 +1002,10 @@ void Editor::VerticalCentreCaret() { void Editor::MoveSelectedLines(int lineDelta) { + if (sel.IsRectangular()) { + return; + } + // if selection doesn't start at the beginning of the line, set the new start Sci::Position selectionStart = SelectionStart().Position(); const Sci::Line startLine = pdoc->SciLineFromPosition(selectionStart); @@ -1054,7 +1058,7 @@ void Editor::MoveSelectedLines(int lineDelta) { pdoc->InsertString(pdoc->Length(), eol, strlen(eol)); GoToLine(currentLine + lineDelta); - selectionLength = pdoc->InsertString(CurrentPosition(), selectedText.Data(), selectionLength); + selectionLength = pdoc->InsertString(CurrentPosition(), selectedText.Data(), selectedText.Length()); if (appendEol) { const Sci::Position lengthInserted = pdoc->InsertString(CurrentPosition() + selectionLength, eol, strlen(eol)); selectionLength += lengthInserted; -- cgit v1.2.3