Figlet text should not pad on right side automatically

This commit is contained in:
Patrik Svensson
2022-11-15 12:25:00 +01:00
committed by Patrik Svensson
parent 02ff3fc910
commit 55c3f3b7a8
7 changed files with 63 additions and 52 deletions

View File

@ -16,6 +16,13 @@ public sealed class FigletText : Renderable, IHasJustification
/// <inheritdoc/>
public Justify? Justification { get; set; }
/// <summary>
/// Gets or sets a value indicating whether or not
/// the right side should be padded.
/// </summary>
/// <remarks>Defaults to <c>false</c>.</remarks>
public bool Pad { get; set; }
/// <summary>
/// Initializes a new instance of the <see cref="FigletText"/> class.
/// </summary>
@ -53,7 +60,7 @@ public sealed class FigletText : Renderable, IHasJustification
{
yield return line;
if (lineWidth < maxWidth)
if (lineWidth < maxWidth && Pad)
{
yield return Segment.Padding(maxWidth - lineWidth);
}
@ -65,7 +72,11 @@ public sealed class FigletText : Renderable, IHasJustification
yield return Segment.Padding(left);
yield return line;
yield return Segment.Padding(right);
if (Pad)
{
yield return Segment.Padding(right);
}
}
else if (alignment == Console.Justify.Right)
{