File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -61,6 +61,16 @@ public override IEnumerable<string> Print(int width, int height)
61
61
goto end ;
62
62
}
63
63
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
+
64
74
var nNewl = Lines . Count ;
65
75
var spacingH = height - ( 1 + nNewl ) ;
66
76
var halfSpacingH = spacingH / 2 ;
@@ -69,7 +79,7 @@ public override IEnumerable<string> Print(int width, int height)
69
79
70
80
// top padding
71
81
for ( var h = 0 ; h < limSpacingH ; h ++ )
72
- yield return "" ;
82
+ yield return emptyLine ;
73
83
74
84
// text content
75
85
foreach ( var str in Lines )
@@ -87,7 +97,7 @@ public override IEnumerable<string> Print(int width, int height)
87
97
// bottom padding
88
98
limSpacingH -= evenSpacingH ? 1 : 0 ;
89
99
for ( var h = 0 ; h < limSpacingH ; h ++ )
90
- yield return "" ;
100
+ yield return emptyLine ;
91
101
92
102
end : ;
93
103
}
You can’t perform that action at this time.
0 commit comments