mirror of
https://github.com/Leonmmcoset/CMLeonOS.git
synced 2026-03-03 15:30:27 +00:00
修复点bug
This commit is contained in:
16
UI/TUI.cs
16
UI/TUI.cs
@@ -156,9 +156,23 @@ namespace CMLeonOS.UI
|
||||
if (y == rect.Top)
|
||||
{
|
||||
Console.Write(corner);
|
||||
|
||||
// Calculate title position
|
||||
int titleX = rect.Left + (rect.Width - title.Length) / 2;
|
||||
int titleStart = titleX;
|
||||
int titleEnd = titleX + title.Length;
|
||||
|
||||
for (int x = rect.Left + 1; x < rect.Right - 1; x++)
|
||||
{
|
||||
Console.Write(horizontal);
|
||||
// Skip drawing horizontal characters where title will be
|
||||
if (!string.IsNullOrEmpty(title) && x >= titleStart && x < titleEnd)
|
||||
{
|
||||
Console.Write(' ');
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.Write(horizontal);
|
||||
}
|
||||
}
|
||||
Console.Write(corner);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user