From c3f5f0d6fd3e27f9b03268e82be45dda51be53c4 Mon Sep 17 00:00:00 2001 From: mintsuki Date: Thu, 8 Jul 2021 16:07:33 +0200 Subject: [PATCH] menu: Nicely box boot menu --- stage23/menu.c | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/stage23/menu.c b/stage23/menu.c index b8c1e84a..f59aff6e 100644 --- a/stage23/menu.c +++ b/stage23/menu.c @@ -552,7 +552,33 @@ refresh: goto autoboot; } - int max_entries = print_tree(" ", 0, 0, selected_entry, menu_tree, + { // Draw box around boot menu + int x, y; + get_cursor_pos(&x, &y); + + print("\xda"); + for (int i = 0; i < term_cols - 2; i++) { + print("\xc4"); + } + print("\xbf"); + + for (int i = y + 1; i < term_rows - 2; i++) { + set_cursor_pos(0, i); + print("\xb3"); + set_cursor_pos(term_cols - 1, i); + print("\xb3"); + } + + print("\xc0"); + for (int i = 0; i < term_cols - 2; i++) { + print("\xc4"); + } + print("\xd9"); + + set_cursor_pos(x, y + 2); + } + + int max_entries = print_tree("\xb3 ", 0, 0, selected_entry, menu_tree, &selected_menu_entry); { @@ -575,7 +601,8 @@ refresh: if (skip_timeout == false) { print("\n\n"); for (int i = timeout; i; i--) { - print("\e[2K\rBooting automatically in %u, press any key to stop the countdown...", i); + set_cursor_pos(0, term_rows - 1); + print("\e[32mBooting automatically in %u, press any key to stop the countdown...\e[0m", i); term_double_buffer_flush(); if ((c = pit_sleep_and_quit_on_keypress(1))) { skip_timeout = true;