Make alignment of TaskDescriptionColumn configurable

This commit is contained in:
Thomas Freudenberg 2021-02-16 23:33:47 +01:00 committed by GitHub
parent ed0fb29be4
commit 525b414ff8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -11,11 +11,16 @@ namespace Spectre.Console
/// <inheritdoc/>
protected internal override bool NoWrap => true;
/// <summary>
/// Gets or sets the alignment of the task description.
/// </summary>
public Justify Alignment { get; set; } = Justify.Right;
/// <inheritdoc/>
public override IRenderable Render(RenderContext context, ProgressTask task, TimeSpan deltaTime)
{
var text = task.Description?.RemoveNewLines()?.Trim();
return new Markup(text ?? string.Empty).Overflow(Overflow.Ellipsis).RightAligned();
return new Markup(text ?? string.Empty).Overflow(Overflow.Ellipsis).Alignment(Alignment);
}
}
}