From 29f72cb83b1565132c075ba815afbaa2b6e421d1 Mon Sep 17 00:00:00 2001 From: Neil Date: Wed, 22 Apr 2026 09:08:34 +1000 Subject: Rename parameters to avoid clang-tidy readability-suspicious-call-argument warnings. --- src/CellBuffer.cxx | 10 +++++----- src/CellBuffer.h | 2 +- src/EditView.cxx | 28 ++++++++++++++-------------- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/CellBuffer.cxx b/src/CellBuffer.cxx index 3d4050633..1eac3f9c2 100644 --- a/src/CellBuffer.cxx +++ b/src/CellBuffer.cxx @@ -510,15 +510,15 @@ ChangedRange CellBuffer::SetStyles(Sci::Position position, const char *styles, S return cr; } -ChangedRange CellBuffer::SetStyleFor(Sci::Position position, Sci::Position lengthStyle, char styleValue) noexcept { - if (!hasStyles || (position < 0) || (lengthStyle <= 0)) { +ChangedRange CellBuffer::SetStyleFor(Sci::Position position, Sci::Position length, char value) noexcept { + if (!hasStyles || (position < 0) || (length <= 0)) { return {}; } - const Lengths lengths = SplitUpdate(style, position, lengthStyle); - ChangedRange cr = SetBytes(&style[position], styleValue, lengths.length1, position); + const Lengths lengths = SplitUpdate(style, position, length); + ChangedRange cr = SetBytes(&style[position], value, lengths.length1, position); if (lengths.length2) { - const ChangedRange cr2 = SetBytes(&style[position + lengths.length1], styleValue, + const ChangedRange cr2 = SetBytes(&style[position + lengths.length1], value, lengths.length2, position + lengths.length1); cr.Merge(cr2); } diff --git a/src/CellBuffer.h b/src/CellBuffer.h index e48eded4d..d54d2be8d 100644 --- a/src/CellBuffer.h +++ b/src/CellBuffer.h @@ -161,7 +161,7 @@ public: /// Setting styles for positions outside the range of the buffer is safe and has no effect. /// @return range where style of characters changed. ChangedRange SetStyles(Sci::Position position, const char *styles, Sci::Position length) noexcept; - ChangedRange SetStyleFor(Sci::Position position, Sci::Position lengthStyle, char styleValue) noexcept; + ChangedRange SetStyleFor(Sci::Position position, Sci::Position length, char value) noexcept; const char *DeleteChars(Sci::Position position, Sci::Position deleteLength, bool &startSequence); diff --git a/src/EditView.cxx b/src/EditView.cxx index 154954c70..b25053845 100644 --- a/src/EditView.cxx +++ b/src/EditView.cxx @@ -2532,14 +2532,14 @@ void EditView::PaintText(Surface *surfaceWindow, const EditModel &model, const V for (;;) { int yposScreen = screenLinePaintFirst * vsDraw.lineHeight; int ypos = bufferedDraw ? 0 : yposScreen; - Sci::Line visibleLine = model.TopLineOfMain() + screenLinePaintFirst; - while (visibleLine < model.pcs->LinesDisplayed() && yposScreen < rcArea.bottom) { + Sci::Line lineVisible = model.TopLineOfMain() + screenLinePaintFirst; + while (lineVisible < model.pcs->LinesDisplayed() && yposScreen < rcArea.bottom) { - const Sci::Line lineDoc = model.pcs->DocFromDisplay(visibleLine); + const Sci::Line lineDoc = model.pcs->DocFromDisplay(lineVisible); // Only visible lines should be handled by the code within the loop PLATFORM_ASSERT(model.pcs->GetVisible(lineDoc)); const Sci::Line lineStartSet = model.pcs->DisplayFromDoc(lineDoc); - const int subLine = static_cast(visibleLine - lineStartSet); + const int subLine = static_cast(lineVisible - lineStartSet); // Copy this line and its styles from the document into local arrays // and determine the x position at which each character starts. @@ -2581,7 +2581,7 @@ void EditView::PaintText(Surface *surfaceWindow, const EditModel &model, const V surface->FillRectangleAligned(rcSpacer, Fill(vsDraw.styles[StyleDefault].back)); } - DrawLine(surface, model, vsDraw, ll.get(), lineDoc, visibleLine, xOrigin, rcLine, subLine, phase); + DrawLine(surface, model, vsDraw, ll.get(), lineDoc, lineVisible, xOrigin, rcLine, subLine, phase); #if defined(TIME_PAINTING) durPaint += ep.Duration(true); #endif @@ -2616,7 +2616,7 @@ void EditView::PaintText(Surface *surfaceWindow, const EditModel &model, const V } yposScreen += vsDraw.lineHeight; - visibleLine++; + lineVisible++; } if (phase >= DrawPhase::carets) { @@ -2763,7 +2763,7 @@ Sci::Position EditView::FormatRange(bool draw, CharacterRangeFull chrg, Rectangl Sci::Line lineDoc = linePrintStart; Sci::Position nPrintPos = chrg.cpMin; - int visibleLine = 0; + int lineVisible = 0; int widthPrint = rc.right - rc.left - vsPrint.fixedColumnWidth; if (printParameters.wrapState == Wrap::None) widthPrint = LineLayout::wrapWidthInfinite; @@ -2792,23 +2792,23 @@ Sci::Position EditView::FormatRange(bool draw, CharacterRangeFull chrg, Rectangl // When document line is wrapped over multiple display lines, find where // to start printing from to ensure a particular position is on the first // line of the page. - if (visibleLine == 0) { + if (lineVisible == 0) { const Sci::Position startWithinLine = nPrintPos - model.pdoc->LineStart(lineDoc); for (int iwl = 0; iwl < ll.lines - 1; iwl++) { if (ll.LineStart(iwl) <= startWithinLine && ll.LineStart(iwl + 1) >= startWithinLine) { - visibleLine = -iwl; + lineVisible = -iwl; } } if (ll.lines > 1 && startWithinLine >= ll.LineStart(ll.lines - 1)) { - visibleLine = -(ll.lines - 1); + lineVisible = -(ll.lines - 1); } } if (draw && lineNumberWidth && (ypos + vsPrint.lineHeight <= rc.bottom) && - (visibleLine >= 0)) { + (lineVisible >= 0)) { const std::string number = std::to_string(lineDoc + 1) + lineNumberPrintSpace; PRectangle rcNumber = rcLine; rcNumber.right = rcNumber.left + lineNumberWidth; @@ -2827,15 +2827,15 @@ Sci::Position EditView::FormatRange(bool draw, CharacterRangeFull chrg, Rectangl for (int iwl = 0; iwl < ll.lines; iwl++) { if (ypos + vsPrint.lineHeight <= rc.bottom) { - if (visibleLine >= 0) { + if (lineVisible >= 0) { if (draw) { rcLine.top = static_cast(ypos); rcLine.bottom = static_cast(ypos + vsPrint.lineHeight); - DrawLine(surface, model, vsPrint, &ll, lineDoc, visibleLine, xOrigin, rcLine, iwl, DrawPhase::all); + DrawLine(surface, model, vsPrint, &ll, lineDoc, lineVisible, xOrigin, rcLine, iwl, DrawPhase::all); } ypos += vsPrint.lineHeight; } - visibleLine++; + lineVisible++; if (iwl == ll.lines - 1) nPrintPos = model.pdoc->LineStart(lineDoc + 1); else -- cgit v1.2.3