in lib/src/highlighter.dart [283:345]
void _writeMultilineHighlights(
_Line line, List<_Highlight?> highlightsByColumn,
{_Highlight? current}) {
// Whether we've written a sidebar indicator for opening a new span on this
// line, and which color should be used for that indicator's rightward line.
var openedOnThisLine = false;
String? openedOnThisLineColor;
final currentColor = current == null
? null
: current.isPrimary
? _primaryColor
: _secondaryColor;
var foundCurrent = false;
for (var highlight in highlightsByColumn) {
final startLine = highlight?.span.start.line;
final endLine = highlight?.span.end.line;
if (current != null && highlight == current) {
foundCurrent = true;
assert(startLine == line.number || endLine == line.number);
_colorize(() {
_buffer.write(startLine == line.number
? glyph.topLeftCorner
: glyph.bottomLeftCorner);
}, color: currentColor);
} else if (foundCurrent) {
_colorize(() {
_buffer.write(highlight == null ? glyph.horizontalLine : glyph.cross);
}, color: currentColor);
} else if (highlight == null) {
if (openedOnThisLine) {
_colorize(() => _buffer.write(glyph.horizontalLine),
color: openedOnThisLineColor);
} else {
_buffer.write(' ');
}
} else {
_colorize(() {
final vertical = openedOnThisLine ? glyph.cross : glyph.verticalLine;
if (current != null) {
_buffer.write(vertical);
} else if (startLine == line.number) {
_colorize(() {
_buffer
.write(glyph.glyphOrAscii(openedOnThisLine ? '┬' : '┌', '/'));
}, color: openedOnThisLineColor);
openedOnThisLine = true;
openedOnThisLineColor ??=
highlight.isPrimary ? _primaryColor : _secondaryColor;
} else if (endLine == line.number &&
highlight.span.end.column == line.text.length) {
_buffer.write(highlight.label == null
? glyph.glyphOrAscii('└', '\\')
: vertical);
} else {
_colorize(() {
_buffer.write(vertical);
}, color: openedOnThisLineColor);
}
}, color: highlight.isPrimary ? _primaryColor : _secondaryColor);
}
}
}