aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2024-03-12 15:12:33 +1100
committerNeil <nyamatongwe@gmail.com>2024-03-12 15:12:33 +1100
commit477a158eb6d4bc035fe7bd5bfc477c7001dcc7dc (patch)
tree9342fc322b7b8128d4319de8f812e65c68cffef0
parentf4ba63335f039d9632f157614cff92d35b14dfa4 (diff)
downloadscintilla-mirror-477a158eb6d4bc035fe7bd5bfc477c7001dcc7dc.tar.gz
Replace magic number 32 with defined MarkerMax (31), adjusting condition.
-rw-r--r--src/EditView.cxx6
-rw-r--r--src/ViewStyle.cxx8
2 files changed, 7 insertions, 7 deletions
diff --git a/src/EditView.cxx b/src/EditView.cxx
index a4fd701a7..b3e024fe1 100644
--- a/src/EditView.cxx
+++ b/src/EditView.cxx
@@ -1744,7 +1744,7 @@ void DrawEdgeLine(Surface *surface, const ViewStyle &vsDraw, const LineLayout *l
void DrawMarkUnderline(Surface *surface, const EditModel &model, const ViewStyle &vsDraw,
Sci::Line line, PRectangle rcLine) {
int marks = model.GetMark(line);
- for (int markBit = 0; (markBit < 32) && marks; markBit++) {
+ for (int markBit = 0; (markBit <= MarkerMax) && marks; markBit++) {
if ((marks & 1) && (vsDraw.markers[markBit].markType == MarkerSymbol::Underline) &&
(vsDraw.markers[markBit].layer == Layer::Base)) {
PRectangle rcUnderline = rcLine;
@@ -1864,7 +1864,7 @@ void DrawTranslucentLineState(Surface *surface, const EditModel &model, const Vi
}
const int marksOfLine = model.GetMark(line);
int marksDrawnInText = marksOfLine & vsDraw.maskDrawInText;
- for (int markBit = 0; (markBit < 32) && marksDrawnInText; markBit++) {
+ for (int markBit = 0; (markBit <= MarkerMax) && marksDrawnInText; markBit++) {
if ((marksDrawnInText & 1) && (vsDraw.markers[markBit].layer == layer)) {
if (vsDraw.markers[markBit].markType == MarkerSymbol::Background) {
surface->FillRectangleAligned(rcLine, vsDraw.markers[markBit].BackWithAlpha());
@@ -1877,7 +1877,7 @@ void DrawTranslucentLineState(Surface *surface, const EditModel &model, const Vi
marksDrawnInText >>= 1;
}
int marksDrawnInLine = marksOfLine & vsDraw.maskInLine;
- for (int markBit = 0; (markBit < 32) && marksDrawnInLine; markBit++) {
+ for (int markBit = 0; (markBit <= MarkerMax) && marksDrawnInLine; markBit++) {
if ((marksDrawnInLine & 1) && (vsDraw.markers[markBit].layer == layer)) {
surface->FillRectangleAligned(rcLine, vsDraw.markers[markBit].BackWithAlpha());
}
diff --git a/src/ViewStyle.cxx b/src/ViewStyle.cxx
index 04f2de977..7ff6919e0 100644
--- a/src/ViewStyle.cxx
+++ b/src/ViewStyle.cxx
@@ -333,7 +333,7 @@ void ViewStyle::CalculateMarginWidthAndMask() noexcept {
maskDefinedMarkers |= m.mask;
}
maskDrawInText = 0;
- for (int markBit = 0; markBit < 32; markBit++) {
+ for (int markBit = 0; markBit <= MarkerMax; markBit++) {
const int maskBit = 1U << markBit;
switch (markers[markBit].markType) {
case MarkerSymbol::Empty:
@@ -349,7 +349,7 @@ void ViewStyle::CalculateMarginWidthAndMask() noexcept {
}
}
maskDrawWrapped = 0;
- for (int markBit = 0; markBit < 32; markBit++) {
+ for (int markBit = 0; markBit <= MarkerMax; markBit++) {
const int maskBit = 1U << markBit;
switch (markers[markBit].markType) {
case MarkerSymbol::Bar:
@@ -538,7 +538,7 @@ ColourOptional ViewStyle::Background(int marksOfLine, bool caretActive, bool lin
}
if (!background && marksOfLine) {
int marks = marksOfLine;
- for (int markBit = 0; (markBit < 32) && marks; markBit++) {
+ for (int markBit = 0; (markBit <= MarkerMax) && marks; markBit++) {
if ((marks & 1) && (markers[markBit].markType == MarkerSymbol::Background) &&
(markers[markBit].layer == Layer::Base)) {
background = markers[markBit].back;
@@ -549,7 +549,7 @@ ColourOptional ViewStyle::Background(int marksOfLine, bool caretActive, bool lin
if (!background && maskInLine) {
int marksMasked = marksOfLine & maskInLine;
if (marksMasked) {
- for (int markBit = 0; (markBit < 32) && marksMasked; markBit++) {
+ for (int markBit = 0; (markBit <= MarkerMax) && marksMasked; markBit++) {
if ((marksMasked & 1) &&
(markers[markBit].layer == Layer::Base)) {
background = markers[markBit].back;