diff options
| author | Neil <nyamatongwe@gmail.com> | 2026-01-31 19:38:38 +1100 |
|---|---|---|
| committer | Neil <nyamatongwe@gmail.com> | 2026-01-31 19:38:38 +1100 |
| commit | 72ea54bf90d39e4d7872e13b8ca25a812b0f3229 (patch) | |
| tree | c6e215a779931b64606f7d2c1e5c96898826e947 | |
| parent | b89a4865d66ae4a5a002f98c3be9db5bc12efffc (diff) | |
| download | scintilla-mirror-72ea54bf90d39e4d7872e13b8ca25a812b0f3229.tar.gz | |
Fix some warnings from magic numbers and else after return.
| -rw-r--r-- | src/EditView.cxx | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/EditView.cxx b/src/EditView.cxx index ee2789ee6..4656ca319 100644 --- a/src/EditView.cxx +++ b/src/EditView.cxx @@ -251,9 +251,8 @@ bool EditView::AddTabstop(Sci::Line line, int x) { int EditView::GetNextTabstop(Sci::Line line, int x) const noexcept { if (ldTabstops) { return ldTabstops->GetNextTabstop(line, x); - } else { - return 0; } + return 0; } void EditView::LinesAddedOrRemoved(Sci::Line lineOfPos, Sci::Line linesAdded) { @@ -408,7 +407,8 @@ void EditView::LayoutLine(const EditModel &model, Surface *surface, const ViewSt posLineEnd = posLineStart + ll->maxLineLength; } // Hard to cope when too narrow, so just assume there is space - width = std::max(width, 20); + constexpr int minimumWidth = 20; + width = std::max(width, minimumWidth); if (ll->validity == LineLayout::ValidLevel::checkTextAndStyle) { Sci::Position lineLength = posLineEnd - posLineStart; @@ -892,9 +892,8 @@ ColourRGBA TextBackground(const EditModel &model, const ViewStyle &vsDraw, const } if (background && (styleMain != StyleBraceLight) && (styleMain != StyleBraceBad)) { return *background; - } else { - return vsDraw.styles[styleMain].back; } + return vsDraw.styles[styleMain].back; } void DrawTextBlob(Surface *surface, const ViewStyle &vsDraw, PRectangle rcSegment, @@ -2108,7 +2107,7 @@ ColourRGBA InvertedLight(ColourRGBA orig) noexcept { r = r * il / l; g = g * il / l; b = b * il / l; - return ColourRGBA(std::min(r, 0xffu), std::min(g, 0xffu), std::min(b, 0xffu)); + return ColourRGBA(std::min(r, maximumByte), std::min(g, maximumByte), std::min(b, maximumByte)); } } @@ -2235,7 +2234,7 @@ void EditView::DrawForeground(Surface *surface, const EditModel &model, const Vi } } else { inIndentation = false; - if (vsDraw.controlCharSymbol >= 32) { + if (vsDraw.controlCharSymbol >= ' ') { // Using one font for all control characters so it can be controlled independently to ensure // the box goes around the characters tightly. Seems to be no way to work out what height // is taken by an individual character - internal leading gives varying results. |
