mirror of
https://github.com/spectreconsole/spectre.console.git
synced 2026-01-01 00:46:42 +01:00
committed by
Patrik Svensson
parent
0119364728
commit
d7bbaf4a85
@@ -28,17 +28,24 @@ namespace Spectre.Console
|
||||
|
||||
var options = new RenderContext(console.Encoding, console.Capabilities.LegacyConsole);
|
||||
|
||||
foreach (var segment in renderable.Render(options, console.Width))
|
||||
using (console.PushStyle(Style.Plain))
|
||||
{
|
||||
if (!segment.Style.Equals(Style.Plain))
|
||||
var current = Style.Plain;
|
||||
foreach (var segment in renderable.Render(options, console.Width))
|
||||
{
|
||||
using (var style = console.PushStyle(segment.Style))
|
||||
if (string.IsNullOrEmpty(segment.Text))
|
||||
{
|
||||
console.Write(segment.Text);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if (!segment.Style.Equals(current))
|
||||
{
|
||||
console.Foreground = segment.Style.Foreground;
|
||||
console.Background = segment.Style.Background;
|
||||
console.Decoration = segment.Style.Decoration;
|
||||
current = segment.Style;
|
||||
}
|
||||
|
||||
console.Write(segment.Text);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user