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
commit063b96ec036ff9780aba514fd34e8cebd93a5345 (patch)
treeedcbab21b57f6ed5604d74140be103e3ed969b7a
parent5707d7fa8b7bae2602c619cf349c1ca06371fe3a (diff)
downloadscintilla-mirror-063b96ec036ff9780aba514fd34e8cebd93a5345.tar.gz
Backport: Reduce code and variable lifetime.
Backport of changeset 8483:c10c2fd7dd1f.
-rw-r--r--src/EditView.cxx9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/EditView.cxx b/src/EditView.cxx
index 1b2beb683..2677cd7e4 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 {