From 6a7f90c15976d7981a886843cfb6f6230359346f Mon Sep 17 00:00:00 2001 From: Neil Date: Mon, 15 Jul 2024 09:17:42 +1000 Subject: Simplify line-end insertions and conversions. --- src/Editor.cxx | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'src/Editor.cxx') 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 ¤t : 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, -- cgit v1.2.3