aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Editor.cxx
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2024-07-15 09:17:42 +1000
committerNeil <nyamatongwe@gmail.com>2024-07-15 09:17:42 +1000
commit6a7f90c15976d7981a886843cfb6f6230359346f (patch)
tree94c3e7d58ca90d6e99c5b4aea34e3cd2d491e433 /src/Editor.cxx
parentafb7753dd17ab7195c5755bb30f572803e149855 (diff)
downloadscintilla-mirror-6a7f90c15976d7981a886843cfb6f6230359346f.tar.gz
Simplify line-end insertions and conversions.
Diffstat (limited to 'src/Editor.cxx')
-rw-r--r--src/Editor.cxx12
1 files changed, 3 insertions, 9 deletions
diff --git a/src/Editor.cxx b/src/Editor.cxx
index e39ab622c..681c0914a 100644
--- a/src/Editor.cxx
+++ b/src/Editor.cxx
@@ -4342,10 +4342,7 @@ bool Editor::CopyLineRange(SelectionText *ss, bool allowProtected) {
if (allowProtected || !RangeContainsProtected(start, end)) {
std::string text = RangeText(start, end);
- if (pdoc->eolMode != EndOfLine::Lf)
- text.push_back('\r');
- if (pdoc->eolMode != EndOfLine::Cr)
- text.push_back('\n');
+ text.append(pdoc->EOLString());
ss->Copy(text, pdoc->dbcsCodePage,
vs.styles[StyleDefault].characterSet, false, true);
return true;
@@ -4365,12 +4362,9 @@ void Editor::CopySelectionRange(SelectionText *ss, bool allowLineCopy) {
if (sel.selType == Selection::SelTypes::rectangle)
std::sort(rangesInOrder.begin(), rangesInOrder.end());
for (const SelectionRange &current : rangesInOrder) {
- text.append(RangeText(current.Start().Position(), current.End().Position()));
+ text.append(RangeText(current.Start().Position(), current.End().Position()));
if (sel.selType == Selection::SelTypes::rectangle) {
- if (pdoc->eolMode != EndOfLine::Lf)
- text.push_back('\r');
- if (pdoc->eolMode != EndOfLine::Cr)
- text.push_back('\n');
+ text.append(pdoc->EOLString());
}
}
ss->Copy(text, pdoc->dbcsCodePage,