diff options
author | Neil <nyamatongwe@gmail.com> | 2021-05-22 09:25:50 +1000 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2021-05-22 09:25:50 +1000 |
commit | ee1886079d0a5cd350ee8e3379be347943ba93ae (patch) | |
tree | 105ef0a0c7a9540ce2a3f90fa7d47fe9334d58c5 /src | |
parent | c8235ba0e0292f209a8233613669e2cff8de80da (diff) | |
download | scintilla-mirror-ee1886079d0a5cd350ee8e3379be347943ba93ae.tar.gz |
Encapsulate whether a margin shows folding.
Diffstat (limited to 'src')
-rw-r--r-- | src/MarginView.cxx | 8 | ||||
-rw-r--r-- | src/ViewStyle.cxx | 4 | ||||
-rw-r--r-- | src/ViewStyle.h | 1 |
3 files changed, 9 insertions, 4 deletions
diff --git a/src/MarginView.cxx b/src/MarginView.cxx index 0c2910a03..68c599b1f 100644 --- a/src/MarginView.cxx +++ b/src/MarginView.cxx @@ -187,7 +187,7 @@ void MarginView::PaintMargin(Surface *surface, Sci::Line topLine, PRectangle rc, rcSelMargin.right = rcSelMargin.left + vs.ms[margin].width; if (vs.ms[margin].style != SC_MARGIN_NUMBER) { - if (vs.ms[margin].mask & SC_MASK_FOLDERS) { + if (vs.ms[margin].ShowsFolding()) { // Required because of special way brush is created for selection margin // Ensure patterns line up when scrolling with separate margin view // by choosing correctly aligned variant. @@ -223,7 +223,7 @@ void MarginView::PaintMargin(Surface *surface, Sci::Line topLine, PRectangle rc, // lessening of fold level which implies a 'fold tail' but which should not // be displayed until the last of a sequence of whitespace. bool needWhiteClosure = false; - if (vs.ms[margin].mask & SC_MASK_FOLDERS) { + if (vs.ms[margin].ShowsFolding()) { const int level = model.pdoc->GetLevel(model.pcs->DocFromDisplay(visibleLine)); if (LevelIsWhitespace(level)) { Sci::Line lineBack = model.pcs->DocFromDisplay(visibleLine); @@ -266,7 +266,7 @@ void MarginView::PaintMargin(Surface *surface, Sci::Line topLine, PRectangle rc, bool headWithTail = false; - if (vs.ms[margin].mask & SC_MASK_FOLDERS) { + if (vs.ms[margin].ShowsFolding()) { // Decide which fold indicator should be displayed const int level = model.pdoc->GetLevel(lineDoc); const int levelNext = model.pdoc->GetLevel(lineDoc + 1); @@ -428,7 +428,7 @@ void MarginView::PaintMargin(Surface *surface, Sci::Line topLine, PRectangle rc, for (int markBit = 0; (markBit < 32) && marks; markBit++) { if (marks & 1) { LineMarker::FoldPart part = LineMarker::FoldPart::undefined; - if ((vs.ms[margin].mask & SC_MASK_FOLDERS) && highlightDelimiter.IsFoldBlockHighlighted(lineDoc)) { + if (vs.ms[margin].ShowsFolding() && highlightDelimiter.IsFoldBlockHighlighted(lineDoc)) { if (highlightDelimiter.IsBodyOfFoldBlock(lineDoc)) { part = LineMarker::FoldPart::body; } else if (highlightDelimiter.IsHeadOfFoldBlock(lineDoc)) { diff --git a/src/ViewStyle.cxx b/src/ViewStyle.cxx index 518ca3bde..675c7cedf 100644 --- a/src/ViewStyle.cxx +++ b/src/ViewStyle.cxx @@ -38,6 +38,10 @@ MarginStyle::MarginStyle(int style_, int width_, int mask_) noexcept : style(style_), width(width_), mask(mask_), sensitive(false), cursor(SC_CURSORREVERSEARROW) { } +bool MarginStyle::ShowsFolding() const noexcept { + return (mask & SC_MASK_FOLDERS) != 0; +} + FontRealised::FontRealised() noexcept = default; FontRealised::~FontRealised() = default; diff --git a/src/ViewStyle.h b/src/ViewStyle.h index 609afdcc4..798595ddc 100644 --- a/src/ViewStyle.h +++ b/src/ViewStyle.h @@ -21,6 +21,7 @@ public: bool sensitive; int cursor; MarginStyle(int style_= SC_MARGIN_SYMBOL, int width_=0, int mask_=0) noexcept; + bool ShowsFolding() const noexcept; }; /** |