From 063b96ec036ff9780aba514fd34e8cebd93a5345 Mon Sep 17 00:00:00 2001 From: Zufu Liu Date: Fri, 21 Aug 2020 13:10:45 +1000 Subject: Backport: Reduce code and variable lifetime. Backport of changeset 8483:c10c2fd7dd1f. --- src/EditView.cxx | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'src') 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 { -- cgit v1.2.3