Skip to content

Commit 037e109

Browse files
authored
Fix figlet centering possibly throwing due to negative size (#1302)
1 parent f7befac commit 037e109

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Spectre.Console/Widgets/Figlet/FigletText.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ protected override IEnumerable<Segment> Render(RenderOptions options, int maxWid
6767
}
6868
else if (alignment == Console.Justify.Center)
6969
{
70-
var left = (maxWidth - lineWidth) / 2;
71-
var right = left + ((maxWidth - lineWidth) % 2);
70+
var left = Math.Max(0, maxWidth - lineWidth) / 2;
71+
var right = left + (Math.Max(0, maxWidth - lineWidth) % 2);
7272

7373
yield return Segment.Padding(left);
7474
yield return line;

0 commit comments

Comments
 (0)