Skip to content

Commit 94348bb

Browse files
committed
Update UiPanel.cs
1 parent c153a7f commit 94348bb

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

textUI/UiPanel.cs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,16 @@ public override IEnumerable<string> Print(int width, int height)
6161
goto end;
6262
}
6363

64+
var emptyLine = string.Empty;
65+
for (var col = 0; col < width; col++)
66+
emptyLine += ' ';
67+
if (Lines.Count == 0 || Lines.All(string.IsNullOrWhiteSpace))
68+
{
69+
for (var row = 0; row < height; row++)
70+
yield return emptyLine;
71+
goto end;
72+
}
73+
6474
var nNewl = Lines.Count;
6575
var spacingH = height - (1 + nNewl);
6676
var halfSpacingH = spacingH / 2;
@@ -69,7 +79,7 @@ public override IEnumerable<string> Print(int width, int height)
6979

7080
// top padding
7181
for (var h = 0; h < limSpacingH; h++)
72-
yield return "";
82+
yield return emptyLine;
7383

7484
// text content
7585
foreach (var str in Lines)
@@ -87,7 +97,7 @@ public override IEnumerable<string> Print(int width, int height)
8797
// bottom padding
8898
limSpacingH -= evenSpacingH ? 1 : 0;
8999
for (var h = 0; h < limSpacingH; h++)
90-
yield return "";
100+
yield return emptyLine;
91101

92102
end: ;
93103
}

0 commit comments

Comments
 (0)