diff options
author | Zufu Liu <unknown> | 2023-01-12 08:11:15 +1100 |
---|---|---|
committer | Zufu Liu <unknown> | 2023-01-12 08:11:15 +1100 |
commit | d57b40b5d815504ccd726ed5f2457df097141fd3 (patch) | |
tree | 92a63b602410e4d4522b0a755cbfdadbfaca6a62 | |
parent | 5d71ee3725bb8d91937208b1aeaf3c99afa9a054 (diff) | |
download | scintilla-mirror-d57b40b5d815504ccd726ed5f2457df097141fd3.tar.gz |
Bug [#2372]. Optimize previous commit.
-rw-r--r-- | src/Editor.cxx | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/Editor.cxx b/src/Editor.cxx index fac808e54..ed97eed2b 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -1623,7 +1623,8 @@ bool Editor::WrapLines(WrapScope ws) { void Editor::LinesJoin() { if (!RangeContainsProtected(targetRange.start.Position(), targetRange.end.Position())) { UndoGroup ug(pdoc); - for (Sci::Position pos = pdoc->LineEndPosition(targetRange.start.Position()); pos < targetRange.end.Position();) { + const Sci::Line line = pdoc->SciLineFromPosition(targetRange.start.Position()); + for (Sci::Position pos = pdoc->LineEnd(line); pos < targetRange.end.Position(); pos = pdoc->LineEnd(line)) { const char chPrev = pdoc->CharAt(pos - 1); const Sci::Position widthChar = pdoc->LenChar(pos); targetRange.end.Add(-widthChar); @@ -1633,7 +1634,6 @@ void Editor::LinesJoin() { const Sci::Position lengthInserted = pdoc->InsertString(pos, " ", 1); targetRange.end.Add(lengthInserted); } - pos = pdoc->LineEndPosition(pos); } } } |