diff --git a/ConsoleUI/Toolkit/ConsoleFrame.cs b/ConsoleUI/Toolkit/ConsoleFrame.cs index 00f81e4013..27c9e0abe0 100644 --- a/ConsoleUI/Toolkit/ConsoleFrame.cs +++ b/ConsoleUI/Toolkit/ConsoleFrame.cs @@ -41,13 +41,12 @@ public override void Draw(bool focused) Console.SetCursorPosition(l, t); Console.Write(doubleBorder ? Symbols.upperLeftCornerDouble : Symbols.upperLeftCorner); if (title.Length > 0) { - int topLeftSidePad = (w - 4 - title.Length) / 2; + int topLeftSidePad = (w - 4 - title.Length) / 2; int topRightSidePad = (w - 4 - title.Length) - topLeftSidePad; - if (topLeftSidePad < 0) { - topLeftSidePad = 0; - } - if (topRightSidePad < 0) { + if (topLeftSidePad < 0 || topRightSidePad < 0) { + topLeftSidePad = 0; topRightSidePad = 0; + title = title.Substring(0, w - 4); } Console.Write(new string(doubleBorder ? Symbols.horizLineDouble : Symbols.horizLine, topLeftSidePad)); Console.Write($" {title} ");