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,8 +72,12 @@ public sealed class FigletText : Renderable, IHasJustification
yield return Segment.Padding(left);
yield return line;
if (Pad)
{
yield return Segment.Padding(right);
}
}
else if (alignment == Console.Justify.Right)
{
if (lineWidth < maxWidth)

View File

@ -1,4 +1,4 @@
.______ ___ .___________..______ __ __ ___ ____ __ ____ ___ _______. __ __ _______ .______ _______
.______ ___ .___________..______ __ __ ___ ____ __ ____ ___ _______. __ __ _______ .______ _______
| _ \ / \ | || _ \ | | | |/ / \ \ / \ / / / \ / | | | | | | ____|| _ \ | ____|
| |_) | / ^ \ `---| |----`| |_) | | | | ' / \ \/ \/ / / ^ \ | (----` | |__| | | |__ | |_) | | |__
| ___/ / /_\ \ | | | / | | | < \ / / /_\ \ \ \ | __ | | __| | / | __|

View File

@ -1,4 +1,4 @@
____ _ _ _
 ____ _ _ _
| _ \ __ _ | |_ _ __ (_) | | __ __ __ __ _ ___
| |_) | / _` | | __| | '__| | | | |/ / \ \ /\ / / / _` | / __|
| __/ | (_| | | |_ | | | | | < \ V V / | (_| | \__ \

View File

@ -1,4 +1,4 @@
____ _ ____ _
 ____ _ ____ _
/ ___| _ __ ___ ___ | |_ _ __ ___ / ___| ___ _ __ ___ ___ | | ___
\___ \ | '_ \ / _ \ / __| | __| | '__| / _ \ | | / _ \ | '_ \ / __| / _ \ | | / _ \
___) | | |_) | | __/ | (__ | |_ | | | __/ _ | |___ | (_) | | | | | \__ \ | (_) | | | | __/

View File

@ -1,4 +1,4 @@
____ _ ____ _
 ____ _ ____ _
/ ___| _ __ ___ ___ | |_ _ __ ___ / ___| ___ _ __ ___ ___ | | ___
\___ \ | '_ \ / _ \ / __| | __| | '__| / _ \ | | / _ \ | '_ \ / __| / _ \ | | / _ \
___) | | |_) | | __/ | (__ | |_ | | | __/ _ | |___ | (_) | | | | | \__ \ | (_) | | | | __/

View File

@ -1,4 +1,4 @@
____ _ ____
 ____ _ ____
/ ___| _ __ ___ ___ | |_ _ __ ___ / ___| ___
\___ \ | '_ \ / _ \ / __| | __| | '__| / _ \ | | / _ \
___) | | |_) | | __/ | (__ | |_ | | | __/ _ | |___ | (_) |