diff options
author | Neil <nyamatongwe@gmail.com> | 2022-10-01 11:22:13 +1000 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2022-10-01 11:22:13 +1000 |
commit | 232fad28e7003fd38e2468258bcfacc61381ef7a (patch) | |
tree | 2efb94aed53d0acf8ab2e36f0ee18ee8e0ef1a1a /src | |
parent | b8202ab86ed353ebb5f6c70bde91df05a2c7a350 (diff) | |
download | scintilla-mirror-232fad28e7003fd38e2468258bcfacc61381ef7a.tar.gz |
Draw SC_MARK_BAR markers underneath other markers as they often cover multiple
lines for change history and other markers mark individual lines.
Diffstat (limited to 'src')
-rw-r--r-- | src/MarginView.cxx | 42 |
1 files changed, 25 insertions, 17 deletions
diff --git a/src/MarginView.cxx b/src/MarginView.cxx index 26848a909..d96c5ec7c 100644 --- a/src/MarginView.cxx +++ b/src/MarginView.cxx @@ -328,20 +328,21 @@ void MarginView::PaintOneMargin(Surface *surface, PRectangle rc, PRectangle rcOn // Decide which fold indicator should be displayed const FoldLevel level = model.pdoc->GetFoldLevel(lineDoc); const FoldLevel levelNext = model.pdoc->GetFoldLevel(lineDoc + 1); - const FoldLevel levelNum = LevelNumberPart(level); - const FoldLevel levelNextNum = LevelNumberPart(levelNext); isExpanded = model.pcs->GetExpanded(lineDoc); marks |= FoldingMark(level, levelNext, firstSubLine, lastSubLine, isExpanded, needWhiteClosure, folderOpenMid, folderEnd); + const FoldLevel levelNum = LevelNumberPart(level); + const FoldLevel levelNextNum = LevelNumberPart(levelNext); + // Change needWhiteClosure and headWithTail if needed if (LevelIsHeader(level)) { needWhiteClosure = false; - const Sci::Line firstFollowupLine = model.pcs->DocFromDisplay(model.pcs->DisplayFromDoc(lineDoc + 1)); - const FoldLevel firstFollowupLineLevel = model.pdoc->GetFoldLevel(firstFollowupLine); - const FoldLevel secondFollowupLineLevelNum = LevelNumberPart(model.pdoc->GetFoldLevel(firstFollowupLine + 1)); if (!isExpanded) { + const Sci::Line firstFollowupLine = model.pcs->DocFromDisplay(model.pcs->DisplayFromDoc(lineDoc + 1)); + const FoldLevel firstFollowupLineLevel = model.pdoc->GetFoldLevel(firstFollowupLine); + const FoldLevel secondFollowupLineLevelNum = LevelNumberPart(model.pdoc->GetFoldLevel(firstFollowupLine + 1)); if (LevelIsWhitespace(firstFollowupLineLevel) && (levelNum > secondFollowupLineLevelNum)) needWhiteClosure = true; @@ -430,18 +431,25 @@ void MarginView::PaintOneMargin(Surface *surface, PRectangle rc, PRectangle rcOn marks &= marginStyle.mask; if (marks) { - for (int markBit = 0; (markBit < 32) && marks; markBit++) { - if (marks & 1) { - LineMarker::FoldPart part = LineMarker::FoldPart::undefined; - if (marginStyle.ShowsFolding() && highlightDelimiter.IsFoldBlockHighlighted(lineDoc)) { - part = PartForFoldHighlight(highlightDelimiter, lineDoc, firstSubLine, headWithTail, isExpanded); - } - if (vs.markers[markBit].markType == MarkerSymbol::Bar) { - const int mask = 1 << markBit; - const bool markBefore = firstSubLine ? (model.GetMark(lineDoc - 1) & mask) : true; - const bool markAfter = lastSubLine ? (model.GetMark(lineDoc + 1) & mask) : true; - part = PartForBar(markBefore, markAfter); - } + // Draw all the bar markers first so they are underneath as they often cover + // multiple lines for change history and other markers mark individual lines. + int marksBar = marks; + for (int markBit = 0; (markBit <= MarkerMax) && marksBar; markBit++) { + if ((marksBar & 1) && (vs.markers[markBit].markType == MarkerSymbol::Bar)) { + const int mask = 1 << markBit; + const bool markBefore = firstSubLine ? (model.GetMark(lineDoc - 1) & mask) : true; + const bool markAfter = lastSubLine ? (model.GetMark(lineDoc + 1) & mask) : true; + vs.markers[markBit].Draw(surface, rcMarker, vs.styles[StyleLineNumber].font.get(), + PartForBar(markBefore, markAfter), marginStyle.style); + } + marksBar >>= 1; + } + // Draw all the other markers over the bar markers + for (int markBit = 0; (markBit <= MarkerMax) && marks; markBit++) { + if ((marks & 1) && (vs.markers[markBit].markType != MarkerSymbol::Bar)) { + const LineMarker::FoldPart part = marginStyle.ShowsFolding() ? + PartForFoldHighlight(highlightDelimiter, lineDoc, firstSubLine, headWithTail, isExpanded) : + LineMarker::FoldPart::undefined; vs.markers[markBit].Draw(surface, rcMarker, vs.styles[StyleLineNumber].font.get(), part, marginStyle.style); } marks >>= 1; |