修复点bug

This commit is contained in:
2026-02-11 14:18:13 +08:00
parent 03b136fd6d
commit ce6d741059
3 changed files with 17 additions and 12 deletions

View File

@@ -1 +1 @@
907cede 03b136f

View File

@@ -309,9 +309,6 @@ namespace CMLeonOS
CMLeonOS.UI.TUIHelper.SetColors(global::System.ConsoleColor.White, global::System.ConsoleColor.Black); CMLeonOS.UI.TUIHelper.SetColors(global::System.ConsoleColor.White, global::System.ConsoleColor.Black);
global::System.Console.Clear(); global::System.Console.Clear();
var titleBar = new CMLeonOS.UI.Window(new CMLeonOS.UI.Rect(0, 0, 80, 3), "First Time Setup", () => { }, false);
titleBar.Render();
var termsBox = new CMLeonOS.UI.Window(new CMLeonOS.UI.Rect(5, 5, 70, 18), "User Terms and Conditions", () => { }, true); var termsBox = new CMLeonOS.UI.Window(new CMLeonOS.UI.Rect(5, 5, 70, 18), "User Terms and Conditions", () => { }, true);
termsBox.Render(); termsBox.Render();
@@ -371,7 +368,6 @@ namespace CMLeonOS
} }
global::System.Console.Clear(); global::System.Console.Clear();
titleBar.Render();
var setupBox = new CMLeonOS.UI.Window(new CMLeonOS.UI.Rect(5, 5, 70, 12), "Admin Account Setup", () => { }, true); var setupBox = new CMLeonOS.UI.Window(new CMLeonOS.UI.Rect(5, 5, 70, 12), "Admin Account Setup", () => { }, true);
setupBox.Render(); setupBox.Render();
@@ -447,9 +443,7 @@ namespace CMLeonOS
CMLeonOS.UI.TUIHelper.SetColors(global::System.ConsoleColor.Green, global::System.ConsoleColor.Black); CMLeonOS.UI.TUIHelper.SetColors(global::System.ConsoleColor.Green, global::System.ConsoleColor.Black);
global::System.Console.SetCursorPosition(7, 24); global::System.Console.SetCursorPosition(7, 24);
global::System.Console.Write("Admin user created successfully! "); global::System.Console.Write("Admin user created successfully! ");
global::System.Console.Clear(); global::System.Console.Clear();
titleBar.Render();
var hostnameBox = new CMLeonOS.UI.Window(new CMLeonOS.UI.Rect(5, 5, 70, 8), "Hostname Setup", () => { }, true); var hostnameBox = new CMLeonOS.UI.Window(new CMLeonOS.UI.Rect(5, 5, 70, 8), "Hostname Setup", () => { }, true);
hostnameBox.Render(); hostnameBox.Render();
@@ -528,9 +522,6 @@ namespace CMLeonOS
CMLeonOS.UI.TUIHelper.SetColors(global::System.ConsoleColor.White, global::System.ConsoleColor.Black); CMLeonOS.UI.TUIHelper.SetColors(global::System.ConsoleColor.White, global::System.ConsoleColor.Black);
global::System.Console.Clear(); global::System.Console.Clear();
var titleBar = new CMLeonOS.UI.Window(new CMLeonOS.UI.Rect(0, 0, 80, 3), "System Login", () => { }, false);
titleBar.Render();
var loginBox = new CMLeonOS.UI.Window(new CMLeonOS.UI.Rect(15, 8, 50, 10), "Login", () => { }, true); var loginBox = new CMLeonOS.UI.Window(new CMLeonOS.UI.Rect(15, 8, 50, 10), "Login", () => { }, true);
loginBox.Render(); loginBox.Render();

View File

@@ -156,10 +156,24 @@ namespace CMLeonOS.UI
if (y == rect.Top) if (y == rect.Top)
{ {
Console.Write(corner); 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++) for (int x = rect.Left + 1; x < rect.Right - 1; x++)
{
// Skip drawing horizontal characters where title will be
if (!string.IsNullOrEmpty(title) && x >= titleStart && x < titleEnd)
{
Console.Write(' ');
}
else
{ {
Console.Write(horizontal); Console.Write(horizontal);
} }
}
Console.Write(corner); Console.Write(corner);
} }
else if (y == rect.Bottom - 1) else if (y == rect.Bottom - 1)