aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorZufu Liu <unknown>2020-08-21 13:10:45 +1000
committerZufu Liu <unknown>2020-08-21 13:10:45 +1000
commit49fab6b701800f4cfa2ae149b0ac2e47e5333ef4 (patch)
tree11abbcc4d27acbb709d97888e5f05e64e1b8364c
parent96792018d4b57dd539228c2502e9cdfe6e3aee69 (diff)
downloadscintilla-mirror-49fab6b701800f4cfa2ae149b0ac2e47e5333ef4.tar.gz
Reduce code and variable lifetime.
-rw-r--r--src/EditView.cxx9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/EditView.cxx b/src/EditView.cxx
index 967e2b5a5..505530054 100644
--- a/src/EditView.cxx
+++ b/src/EditView.cxx
@@ -396,22 +396,19 @@ void EditView::LayoutLine(const EditModel &model, Sci::Line line, Surface *surfa
// See if chars, styles, indicators, are all the same
bool allSame = true;
// Check base line layout
- int styleByte = 0;
- int numCharsInLine = 0;
char chPrevious = 0;
- while (numCharsInLine < lineLength) {
+ for (Sci::Position numCharsInLine = 0; numCharsInLine < lineLength; numCharsInLine++) {
const Sci::Position charInDoc = numCharsInLine + posLineStart;
const char chDoc = model.pdoc->CharAt(charInDoc);
- styleByte = model.pdoc->StyleIndexAt(charInDoc);
+ const int styleByte = model.pdoc->StyleIndexAt(charInDoc);
allSame = allSame &&
(ll->styles[numCharsInLine] == styleByte);
allSame = allSame &&
(ll->chars[numCharsInLine] == CaseForce(vstyle.styles[styleByte].caseForce, chDoc, chPrevious));
chPrevious = chDoc;
- numCharsInLine++;
}
const int styleByteLast = (posLineEnd > posLineStart) ? model.pdoc->StyleIndexAt(posLineEnd - 1) : 0;
- allSame = allSame && (ll->styles[numCharsInLine] == styleByteLast); // For eolFilled
+ allSame = allSame && (ll->styles[lineLength] == styleByteLast); // For eolFilled
if (allSame) {
ll->validity = LineLayout::ValidLevel::positions;
} else {