From 8895da569aa861143b5fd1dbf3bfc7de52594158 Mon Sep 17 00:00:00 2001 From: Zufu Liu Date: Fri, 9 Dec 2022 13:01:23 +1100 Subject: Feature [feature-requests:#1458] Replace complex CopySelectionRange call with simpler RangeText. This also preserves any NUL characters. --- src/Editor.cxx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/Editor.cxx b/src/Editor.cxx index 72a8a4bd8..68fd83e7a 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -1058,8 +1058,7 @@ void Editor::MoveSelectedLines(int lineDelta) { } SetSelection(selectionStart, selectionEnd); - SelectionText selectedText; - CopySelectionRange(&selectedText); + const std::string selectedText = RangeText(selectionStart, selectionEnd); const Point currentLocation = LocationFromPosition(CurrentPosition()); const Sci::Line currentLine = LineFromLocation(currentLocation); @@ -1073,7 +1072,7 @@ void Editor::MoveSelectedLines(int lineDelta) { pdoc->InsertString(pdoc->Length(), eol, strlen(eol)); GoToLine(currentLine + lineDelta); - Sci::Position selectionLength = pdoc->InsertString(CurrentPosition(), selectedText.Data(), selectedText.Length()); + Sci::Position selectionLength = pdoc->InsertString(CurrentPosition(), selectedText); if (appendEol) { const Sci::Position lengthInserted = pdoc->InsertString(CurrentPosition() + selectionLength, eol, strlen(eol)); selectionLength += lengthInserted; -- cgit v1.2.3