aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorZufu Liu <unknown>2023-01-12 22:20:11 +1100
committerZufu Liu <unknown>2023-01-12 22:20:11 +1100
commitb3574a4cf62c635758ed2aee27eca10909b23e0e (patch)
tree9296a2c5f5e1e5beb25a6b65a7a2f8ed35a4a390
parent28ad37395deee65fb4a20a6bc59453d06505b0e7 (diff)
downloadscintilla-mirror-b3574a4cf62c635758ed2aee27eca10909b23e0e.tar.gz
Feature [feature-requests:#1474] Simplify code.
-rw-r--r--src/Document.cxx7
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