From ce6d741059c1cad1ef8be662b86c1cf958f3fe63 Mon Sep 17 00:00:00 2001 From: Leonmmcoset Date: Wed, 11 Feb 2026 14:18:13 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=82=B9bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- GitCommit.txt | 2 +- System/UserSystem.cs | 11 +---------- UI/TUI.cs | 16 +++++++++++++++- 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/GitCommit.txt b/GitCommit.txt index d93e83a..8cf14bc 100644 --- a/GitCommit.txt +++ b/GitCommit.txt @@ -1 +1 @@ -907cede \ No newline at end of file +03b136f \ No newline at end of file diff --git a/System/UserSystem.cs b/System/UserSystem.cs index d0bab31..abd3af7 100644 --- a/System/UserSystem.cs +++ b/System/UserSystem.cs @@ -309,10 +309,7 @@ namespace CMLeonOS CMLeonOS.UI.TUIHelper.SetColors(global::System.ConsoleColor.White, global::System.ConsoleColor.Black); 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(); CMLeonOS.UI.TUIHelper.SetColors(global::System.ConsoleColor.Gray, global::System.ConsoleColor.Black); @@ -371,7 +368,6 @@ namespace CMLeonOS } global::System.Console.Clear(); - titleBar.Render(); var setupBox = new CMLeonOS.UI.Window(new CMLeonOS.UI.Rect(5, 5, 70, 12), "Admin Account Setup", () => { }, true); setupBox.Render(); @@ -447,9 +443,7 @@ namespace CMLeonOS CMLeonOS.UI.TUIHelper.SetColors(global::System.ConsoleColor.Green, global::System.ConsoleColor.Black); global::System.Console.SetCursorPosition(7, 24); global::System.Console.Write("Admin user created successfully! "); - global::System.Console.Clear(); - titleBar.Render(); var hostnameBox = new CMLeonOS.UI.Window(new CMLeonOS.UI.Rect(5, 5, 70, 8), "Hostname Setup", () => { }, true); hostnameBox.Render(); @@ -528,9 +522,6 @@ namespace CMLeonOS CMLeonOS.UI.TUIHelper.SetColors(global::System.ConsoleColor.White, global::System.ConsoleColor.Black); 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); loginBox.Render(); diff --git a/UI/TUI.cs b/UI/TUI.cs index 38c7592..739360c 100644 --- a/UI/TUI.cs +++ b/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); }