mirror of
https://github.com/nsnail/spectre.console.git
synced 2025-12-29 20:05:48 +08:00
Do not draw tables that can't be drawn
This is a temporary fix for undrawable tables until we've implemented a proper strategy. What this does is that it replaces an undrawable table with an ellipsis (...). This should only occur in either super big tables or deeply nested tables in a console with a small buffer width.
This commit is contained in:
committed by
Patrik Svensson
parent
a2f507e58f
commit
bfffef630f
@@ -193,6 +193,12 @@ namespace Spectre.Console
|
||||
|
||||
private List<SegmentLine> SplitLines(RenderContext context, int maxWidth)
|
||||
{
|
||||
if (maxWidth <= 0)
|
||||
{
|
||||
// Nothing fits, so return an empty line.
|
||||
return new List<SegmentLine>();
|
||||
}
|
||||
|
||||
if (_lines.Max(x => x.CellWidth(context)) <= maxWidth)
|
||||
{
|
||||
return Clone();
|
||||
|
||||
Reference in New Issue
Block a user