aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Editor.cxx
diff options
context:
space:
mode:
authorZufu Liu <unknown>2022-12-09 13:01:23 +1100
committerZufu Liu <unknown>2022-12-09 13:01:23 +1100
commit8895da569aa861143b5fd1dbf3bfc7de52594158 (patch)
tree89c8a97289c550dd1656df2e9b7929845eba1df9 /src/Editor.cxx
parent9c64cb98296896d292b1d9c7842a35de8e4e18a6 (diff)
downloadscintilla-mirror-8895da569aa861143b5fd1dbf3bfc7de52594158.tar.gz
Feature [feature-requests:#1458] Replace complex CopySelectionRange call with
simpler RangeText. This also preserves any NUL characters.
Diffstat (limited to 'src/Editor.cxx')
-rw-r--r--src/Editor.cxx5
1 files changed, 2 insertions, 3 deletions
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;