This commit is contained in:
2026-08-11 21:00:46 +02:00
parent 9c65dafdcf
commit 12586262cb
+13 -20
View File
@@ -133,7 +133,7 @@ namespace MarcerGameDvdLauncher
_cachedBuffer[i].Text = null!; _cachedBuffer[i].Text = null!;
} }
// Renders a centered, bordered help box with key bindings inside the // Renders a centered help box with key bindings inside the
// available console area. The caller is responsible for waiting on a // available console area. The caller is responsible for waiting on a
// key and redrawing the menu afterward. // key and redrawing the menu afterward.
public void ShowHelpBox(int availableLines) public void ShowHelpBox(int availableLines)
@@ -147,26 +147,18 @@ namespace MarcerGameDvdLauncher
Console.BackgroundColor = ConsoleColor.DarkGray; Console.BackgroundColor = ConsoleColor.DarkGray;
Console.ForegroundColor = ConsoleColor.White; Console.ForegroundColor = ConsoleColor.White;
var topBorder = "+" + new string('-', Math.Max(0, boxWidth - 2)) + "+"; // Fill the box area without borders for cleaner appearance
Console.SetCursorPosition(0, topRow); for (var i = 0; i < boxHeight; i++)
Console.Write(topBorder); {
var row = topRow + i;
for (var i = 0; i < boxHeight - 2; i++) if (row < Console.WindowHeight)
{ {
var row = topRow + 1 + i;
var content = i < helpLines.Length
? PadToWidth(helpLines[i], boxWidth - 2)
: new string(' ', Math.Max(0, boxWidth - 2));
Console.SetCursorPosition(0, row); Console.SetCursorPosition(0, row);
Console.Write("|" + content + "|"); var content = i == 0 || i == boxHeight - 1 || i >= helpLines.Length + 2
? new string(' ', boxWidth)
: PadToWidth(helpLines[i - 1], boxWidth);
Console.Write(content);
} }
var bottomRow = topRow + boxHeight - 1;
if (bottomRow < Console.WindowHeight)
{
var bottomBorder = "+" + new string('-', Math.Max(0, boxWidth - 2)) + "+";
Console.SetCursorPosition(0, bottomRow);
Console.Write(bottomBorder);
} }
Console.ResetColor(); Console.ResetColor();
} }
@@ -178,8 +170,9 @@ namespace MarcerGameDvdLauncher
" ", " ",
" ↑ / ↓ Move selection up / down", " ↑ / ↓ Move selection up / down",
" Enter / → Open folder / launch ZIP with Hatari", " Enter / → Open folder / launch ZIP with Hatari",
" ← / BS Go up one directory (never exceeds root)", " ← / Backspace Go up one directory (never exceeds root)",
" ESC / Q Exit the program", " ESC Exit the program",
" q Exit the program (alternative)",
" PgUp Jump one page up", " PgUp Jump one page up",
" PgDn Jump one page down", " PgDn Jump one page down",
" * Toggle favorite on selected ZIP", " * Toggle favorite on selected ZIP",