diff options
author | Zufu Liu <unknown> | 2023-01-12 22:20:11 +1100 |
---|---|---|
committer | Zufu Liu <unknown> | 2023-01-12 22:20:11 +1100 |
commit | b3574a4cf62c635758ed2aee27eca10909b23e0e (patch) | |
tree | 9296a2c5f5e1e5beb25a6b65a7a2f8ed35a4a390 /src/Document.cxx | |
parent | 28ad37395deee65fb4a20a6bc59453d06505b0e7 (diff) | |
download | scintilla-mirror-b3574a4cf62c635758ed2aee27eca10909b23e0e.tar.gz |
Feature [feature-requests:#1474] Simplify code.
Diffstat (limited to 'src/Document.cxx')
-rw-r--r-- | src/Document.cxx | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/Document.cxx b/src/Document.cxx index 03a3d4326..95777278c 100644 --- a/src/Document.cxx +++ b/src/Document.cxx @@ -512,7 +512,7 @@ Sci::Position Document::VCHomePosition(Sci::Position position) const { const Sci::Position startPosition = LineStart(line); const Sci::Position endLine = LineEnd(line); Sci::Position startText = startPosition; - while (startText < endLine && (cb.CharAt(startText) == ' ' || cb.CharAt(startText) == '\t')) + while (startText < endLine && IsSpaceOrTab(cb.CharAt(startText))) startText++; if (position == startText) return startPosition; @@ -1712,7 +1712,8 @@ void Document::ConvertLineEnds(EndOfLine eolModeSet) { UndoGroup ug(this); for (Sci::Position pos = 0; pos < Length(); pos++) { - if (cb.CharAt(pos) == '\r') { + const char ch = cb.CharAt(pos); + if (ch == '\r') { if (cb.CharAt(pos + 1) == '\n') { // CRLF if (eolModeSet == EndOfLine::Cr) { @@ -1732,7 +1733,7 @@ void Document::ConvertLineEnds(EndOfLine eolModeSet) { pos--; } } - } else if (cb.CharAt(pos) == '\n') { + } else if (ch == '\n') { // LF if (eolModeSet == EndOfLine::CrLf) { pos += InsertString(pos, "\r", 1); // Insert CR |