mirror of
https://github.com/nsnail/spectre.console.git
synced 2025-12-29 20:05:48 +08:00
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:
committed by
Patrik Svensson
parent
1410cba6c5
commit
5a1b8a1710
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user