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 | |
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.
-rw-r--r-- | doc/ScintillaDoc.html | 9 | ||||
-rw-r--r-- | doc/ScintillaHistory.html | 4 | ||||
-rw-r--r-- | src/MarginView.cxx | 42 |
3 files changed, 35 insertions, 20 deletions
diff --git a/doc/ScintillaDoc.html b/doc/ScintillaDoc.html index 351a3d9ab..a9a7e72ed 100644 --- a/doc/ScintillaDoc.html +++ b/doc/ScintillaDoc.html @@ -129,7 +129,7 @@ <h1>Scintilla Documentation</h1> - <p>Last edited 26 August 2022 NH</p> + <p>Last edited 1 October 2022 NH</p> <p style="background:#90F0C0">Scintilla 5 has moved the lexers from Scintilla into a new <a href="Lexilla.html">Lexilla</a> project.<br /> @@ -5175,8 +5175,11 @@ struct Sci_TextToFindFull { (<code>SC_MARK_</code>*) or you can use characters. By default, all 32 markers are set to <code>SC_MARK_CIRCLE</code> with a black foreground and a white background.</p> - <p>The markers are drawn in the order of their numbers, so higher numbered markers appear on - top of lower numbered ones. Markers try to move with their text by tracking where the start of + <p>The markers are drawn in the order of their numbers (except for <code>SC_MARK_BAR</code>), so higher + numbered markers appear on top of lower numbered ones. + <code>SC_MARK_BAR</code> markers are drawn first so they are underneath as they often cover + multiple lines for change history and other markers mark individual lines. + Markers try to move with their text by tracking where the start of their line moves. When a line is deleted, its markers are combined, by an <code>OR</code> operation, with the markers of the next line.</p> <code><a class="message" href="#SCI_MARKERDEFINE">SCI_MARKERDEFINE(int markerNumber, int diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html index 079095ae0..abbf4f4ef 100644 --- a/doc/ScintillaHistory.html +++ b/doc/ScintillaHistory.html @@ -595,6 +595,10 @@ may appear and then disappear depending on which lines were drawn. </li> <li> + Draw SC_MARK_BAR markers underneath other markers + as they often cover multiple lines for change history and other markers mark individual lines. + </li> + <li> Enlarge point and point top indicators and scale to be larger with larger text. </li> <li> 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; |