diff --git a/src/Spectre.Console/Widgets/Progress/Columns/SpinnerColumn.cs b/src/Spectre.Console/Widgets/Progress/Columns/SpinnerColumn.cs index 1669a17..deb9809 100644 --- a/src/Spectre.Console/Widgets/Progress/Columns/SpinnerColumn.cs +++ b/src/Spectre.Console/Widgets/Progress/Columns/SpinnerColumn.cs @@ -16,6 +16,7 @@ namespace Spectre.Console private Spinner _spinner; private int? _maxWidth; private string? _completed; + private string? _pending; /// protected internal override bool NoWrap => true; @@ -50,11 +51,30 @@ namespace Spectre.Console } } + /// + /// Gets or sets the text that should be shown instead + /// of the spinner before a task begins. + /// + public string? PendingText + { + get => _pending; + set + { + _pending = value; + _maxWidth = null; + } + } + /// /// Gets or sets the completed style. /// public Style? CompletedStyle { get; set; } + /// + /// Gets or sets the pending style. + /// + public Style? PendingStyle { get; set; } + /// /// Gets or sets the style of the spinner. /// @@ -84,7 +104,12 @@ namespace Spectre.Console var useAscii = (context.LegacyConsole || !context.Unicode) && _spinner.IsUnicode; var spinner = useAscii ? Spinner.Known.Ascii : _spinner ?? Spinner.Known.Default; - if (!task.IsStarted || task.IsFinished) + if (!task.IsStarted) + { + return new Markup(PendingText ?? " ", PendingStyle ?? Style.Plain); + } + + if (task.IsFinished) { return new Markup(CompletedText ?? " ", CompletedStyle ?? Style.Plain); } @@ -117,7 +142,9 @@ namespace Spectre.Console var spinner = useAscii ? Spinner.Known.Ascii : _spinner ?? Spinner.Known.Default; _maxWidth = Math.Max( - ((IRenderable)new Markup(CompletedText ?? " ")).Measure(context, int.MaxValue).Max, + Math.Max( + ((IRenderable)new Markup(PendingText ?? " ")).Measure(context, int.MaxValue).Max, + ((IRenderable)new Markup(CompletedText ?? " ")).Measure(context, int.MaxValue).Max), spinner.Frames.Max(frame => Cell.GetCellLength(context, frame))); }