Add rule widget

Adds a new rule widget.
Also fixes some bugs I encountered while testing
some unrelated things in an extremely small console.
This commit is contained in:
Patrik Svensson
2020-10-20 01:07:58 +02:00
committed by Patrik Svensson
parent 1410cba6c5
commit 5a1b8a1710
16 changed files with 610 additions and 80 deletions

View File

@@ -138,7 +138,9 @@ namespace Spectre.Console
return Array.Empty<Segment>();
}
var lines = SplitLines(context, maxWidth);
var lines = context.SingleLine
? new List<SegmentLine>(_lines)
: SplitLines(context, maxWidth);
// Justify lines
var justification = context.Justification ?? Alignment ?? Justify.Left;
@@ -170,6 +172,11 @@ namespace Spectre.Console
}
}
if (context.SingleLine)
{
return lines.First().Where(segment => !segment.IsLineBreak);
}
return new SegmentLineEnumerator(lines);
}