diff --git a/src/Spectre.Console/Extensions/Columns/PercentageColumnExtensions.cs b/src/Spectre.Console/Extensions/Progress/PercentageColumnExtensions.cs similarity index 100% rename from src/Spectre.Console/Extensions/Columns/PercentageColumnExtensions.cs rename to src/Spectre.Console/Extensions/Progress/PercentageColumnExtensions.cs diff --git a/src/Spectre.Console/Extensions/Columns/ProgressBarColumnExtensions.cs b/src/Spectre.Console/Extensions/Progress/ProgressBarColumnExtensions.cs similarity index 100% rename from src/Spectre.Console/Extensions/Columns/ProgressBarColumnExtensions.cs rename to src/Spectre.Console/Extensions/Progress/ProgressBarColumnExtensions.cs diff --git a/src/Spectre.Console/Extensions/ProgressExtensions.cs b/src/Spectre.Console/Extensions/Progress/ProgressExtensions.cs similarity index 100% rename from src/Spectre.Console/Extensions/ProgressExtensions.cs rename to src/Spectre.Console/Extensions/Progress/ProgressExtensions.cs diff --git a/src/Spectre.Console/Extensions/ProgressTaskExtensions.cs b/src/Spectre.Console/Extensions/Progress/ProgressTaskExtensions.cs similarity index 100% rename from src/Spectre.Console/Extensions/ProgressTaskExtensions.cs rename to src/Spectre.Console/Extensions/Progress/ProgressTaskExtensions.cs diff --git a/src/Spectre.Console/Extensions/Columns/RemainingTimeColumnExtensions.cs b/src/Spectre.Console/Extensions/Progress/RemainingTimeColumnExtensions.cs similarity index 100% rename from src/Spectre.Console/Extensions/Columns/RemainingTimeColumnExtensions.cs rename to src/Spectre.Console/Extensions/Progress/RemainingTimeColumnExtensions.cs diff --git a/src/Spectre.Console/Extensions/Columns/SpinnerColumnExtensions.cs b/src/Spectre.Console/Extensions/Progress/SpinnerColumnExtensions.cs similarity index 88% rename from src/Spectre.Console/Extensions/Columns/SpinnerColumnExtensions.cs rename to src/Spectre.Console/Extensions/Progress/SpinnerColumnExtensions.cs index bfa6a13..2bd00e7 100644 --- a/src/Spectre.Console/Extensions/Columns/SpinnerColumnExtensions.cs +++ b/src/Spectre.Console/Extensions/Progress/SpinnerColumnExtensions.cs @@ -20,11 +20,7 @@ namespace Spectre.Console throw new ArgumentNullException(nameof(column)); } - if (style != null) - { - column.Style = style; - } - + column.Style = style; return column; } } diff --git a/src/Spectre.Console/Extensions/StatusContextExtensions.cs b/src/Spectre.Console/Extensions/Progress/StatusContextExtensions.cs similarity index 100% rename from src/Spectre.Console/Extensions/StatusContextExtensions.cs rename to src/Spectre.Console/Extensions/Progress/StatusContextExtensions.cs diff --git a/src/Spectre.Console/Extensions/StatusExtensions.cs b/src/Spectre.Console/Extensions/Progress/StatusExtensions.cs similarity index 100% rename from src/Spectre.Console/Extensions/StatusExtensions.cs rename to src/Spectre.Console/Extensions/Progress/StatusExtensions.cs diff --git a/src/Spectre.Console/Progress/Renderers/StatusFallbackRenderer.cs b/src/Spectre.Console/Progress/Renderers/StatusFallbackRenderer.cs index dd07a2c..2c88181 100644 --- a/src/Spectre.Console/Progress/Renderers/StatusFallbackRenderer.cs +++ b/src/Spectre.Console/Progress/Renderers/StatusFallbackRenderer.cs @@ -11,7 +11,7 @@ namespace Spectre.Console.Internal private IRenderable? _renderable; private string? _lastStatus; - public override TimeSpan RefreshRate => TimeSpan.FromSeconds(1); + public override TimeSpan RefreshRate => TimeSpan.FromMilliseconds(100); public StatusFallbackRenderer() { diff --git a/src/Spectre.Console/Rendering/LiveRenderable.cs b/src/Spectre.Console/Rendering/LiveRenderable.cs index e8c163f..1e4f621 100644 --- a/src/Spectre.Console/Rendering/LiveRenderable.cs +++ b/src/Spectre.Console/Rendering/LiveRenderable.cs @@ -54,7 +54,7 @@ namespace Spectre.Console.Rendering var shape = SegmentShape.Calculate(context, lines); _shape = _shape == null ? shape : _shape.Value.Inflate(shape); - _shape.Value.SetShape(context, lines); + _shape.Value.Apply(context, ref lines); foreach (var (_, _, last, line) in lines.Enumerate()) { diff --git a/src/Spectre.Console/Rendering/Segment.cs b/src/Spectre.Console/Rendering/Segment.cs index 3d03417..87ab08c 100644 --- a/src/Spectre.Console/Rendering/Segment.cs +++ b/src/Spectre.Console/Rendering/Segment.cs @@ -620,49 +620,5 @@ namespace Spectre.Console.Rendering return cells; } - - internal static (int Width, int Height) GetShape(RenderContext context, List lines) - { - if (context is null) - { - throw new ArgumentNullException(nameof(context)); - } - - if (lines is null) - { - throw new ArgumentNullException(nameof(lines)); - } - - var height = lines.Count; - var width = lines.Max(l => CellCount(context, l)); - - return (width, height); - } - - internal static List SetShape(RenderContext context, List lines, (int Width, int Height) shape) - { - foreach (var line in lines) - { - var length = CellCount(context, line); - var missing = shape.Width - length; - if (missing > 0) - { - line.Add(new Segment(new string(' ', missing))); - } - } - - if (lines.Count < shape.Height) - { - var missing = shape.Height - lines.Count; - for (int i = 0; i < missing; i++) - { - var line = new SegmentLine(); - line.Add(new Segment(new string(' ', shape.Width))); - lines.Add(line); - } - } - - return lines; - } } } diff --git a/src/Spectre.Console/Rendering/SegmentShape.cs b/src/Spectre.Console/Rendering/SegmentShape.cs index d6d7a0f..149d46b 100644 --- a/src/Spectre.Console/Rendering/SegmentShape.cs +++ b/src/Spectre.Console/Rendering/SegmentShape.cs @@ -40,7 +40,7 @@ namespace Spectre.Console.Rendering Math.Max(Height, other.Height)); } - public void SetShape(RenderContext context, List lines) + public void Apply(RenderContext context, ref List lines) { foreach (var line in lines) { @@ -52,14 +52,15 @@ namespace Spectre.Console.Rendering } } - if (lines.Count < Height) + if (lines.Count < Height && Width > 0) { var missing = Height - lines.Count; for (var i = 0; i < missing; i++) { - var line = new SegmentLine(); - line.Add(new Segment(new string(' ', Width))); - lines.Add(line); + lines.Add(new SegmentLine + { + new Segment(new string(' ', Width)), + }); } } }