mirror of
https://github.com/nsnail/spectre.console.git
synced 2025-04-16 17:02:51 +08:00
Make alignment of TaskDescriptionColumn configurable
This commit is contained in:
parent
ed0fb29be4
commit
525b414ff8
@ -11,11 +11,16 @@ namespace Spectre.Console
|
|||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
protected internal override bool NoWrap => true;
|
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/>
|
/// <inheritdoc/>
|
||||||
public override IRenderable Render(RenderContext context, ProgressTask task, TimeSpan deltaTime)
|
public override IRenderable Render(RenderContext context, ProgressTask task, TimeSpan deltaTime)
|
||||||
{
|
{
|
||||||
var text = task.Description?.RemoveNewLines()?.Trim();
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user