From f1f56958eae7d6f1f7f69bfd7277841f690780e2 Mon Sep 17 00:00:00 2001 From: mintsuki Date: Thu, 30 Mar 2023 01:23:55 +0200 Subject: [PATCH] term: Drop in_bootloader for new Flanterm --- common/drivers/vga_textmode.c | 2 - common/lib/gterm.c | 2 - common/lib/term.c | 4 +- common/lib/term.h | 1 - common/menu.c | 70 +++++++++++++++++------------------ common/protos/limine.c | 1 - 6 files changed, 36 insertions(+), 44 deletions(-) diff --git a/common/drivers/vga_textmode.c b/common/drivers/vga_textmode.c index 473f00b3..8f83768c 100644 --- a/common/drivers/vga_textmode.c +++ b/common/drivers/vga_textmode.c @@ -346,8 +346,6 @@ void vga_textmode_init(bool managed) { term->full_refresh = text_full_refresh; term->deinit = text_deinit; - term->in_bootloader = true; - flanterm_context_reinit(term); if (!managed) { diff --git a/common/lib/gterm.c b/common/lib/gterm.c index f2a85c13..82b5b229 100644 --- a/common/lib/gterm.c +++ b/common/lib/gterm.c @@ -843,8 +843,6 @@ no_load_font:; term->cols = min_cols; term->rows = min_rows; - term->in_bootloader = true; - flanterm_context_reinit(term); } diff --git a/common/lib/term.c b/common/lib/term.c index 85961128..57ca6049 100644 --- a/common/lib/term.c +++ b/common/lib/term.c @@ -211,8 +211,6 @@ void term_fallback(void) { #endif term_backend = FALLBACK; flanterm_context_reinit(term); - - term->in_bootloader = true; #if defined (UEFI) } #endif @@ -357,7 +355,7 @@ void _term_write(struct flanterm_context *term, uint64_t buf, uint64_t count) { bool autoflush = term->autoflush; term->autoflush = false; - if (term->in_bootloader || native) { + if (native) { const char *s = (const char *)(uintptr_t)buf; flanterm_write(term, s, count); diff --git a/common/lib/term.h b/common/lib/term.h index 5dc3b696..9f28c7d8 100644 --- a/common/lib/term.h +++ b/common/lib/term.h @@ -43,7 +43,6 @@ inline void reset_term(void) { print("\e[2J\e[H"); flanterm_context_reinit(term); - term->in_bootloader = true; term->cursor_enabled = true; term->double_buffer_flush(term); } diff --git a/common/menu.c b/common/menu.c index d4bac48c..3a7c84f0 100644 --- a/common/menu.c +++ b/common/menu.c @@ -226,12 +226,12 @@ refresh: print(" \e[32mESC\e[0m Discard and Exit \e[32mF10\e[0m Boot\n\n"); - print(serial ? "/" : "\xda"); + print(serial ? "/" : "┌"); for (size_t i = 0; i < terms[0]->cols - 2; i++) { switch (i) { case 1: case 2: case 3: if (window_offset > 0) { - print(serial ? "^" : "\x18"); + print(serial ? "^" : "↑"); break; } // FALLTHRU @@ -241,7 +241,7 @@ refresh: print("%s", title); i += title_length - 1; } else { - print(serial ? "-" : "\xc4"); + print(serial ? "-" : "─"); } } } @@ -249,9 +249,9 @@ refresh: size_t tmpx, tmpy; terms[0]->get_cursor_pos(terms[0], &tmpx, &tmpy); - print(serial ? "\\" : "\xbf"); + print(serial ? "\\" : "┐"); set_cursor_pos_helper(0, tmpy + 1); - print(serial ? "|" : "\xb3"); + print(serial ? "|" : "│"); size_t cursor_x, cursor_y; size_t current_line = 0, line_offset = 0, window_size = _window_size; @@ -273,14 +273,14 @@ refresh: set_cursor_pos_helper(terms[0]->cols - 1, y); if (current_line == window_offset + window_size - 1) { terms[0]->get_cursor_pos(terms[0], &tmpx, &tmpy); - print(serial ? "|" : "\xb3"); + print(serial ? "|" : "│"); set_cursor_pos_helper(0, tmpy + 1); - print(serial ? "\\" : "\xc0"); + print(serial ? "\\" : "└"); } else { terms[0]->get_cursor_pos(terms[0], &tmpx, &tmpy); - print(serial ? "|" : "\xb3"); + print(serial ? "|" : "│"); set_cursor_pos_helper(0, tmpy + 1); - print(serial ? "|" : "\xb3"); + print(serial ? "|" : "│"); } line_offset = 0; token_type = validate_line(buffer + i + 1); @@ -307,13 +307,13 @@ refresh: size_t x, y; terms[0]->get_cursor_pos(terms[0], &x, &y); if (y == terms[0]->rows - 3) { - print(serial ? ">" : "\x1a"); + print(serial ? ">" : "→"); set_cursor_pos_helper(0, y + 1); - print(serial ? "\\" : "\xc0"); + print(serial ? "\\" : "└"); } else { - print(serial ? ">" : "\x1a"); + print(serial ? ">" : "→"); set_cursor_pos_helper(0, y + 1); - print(serial ? "<" : "\x1b\x1b"); + print(serial ? "<" : "←"); } } window_size--; @@ -387,31 +387,31 @@ refresh: for (size_t i = 0; i < (window_size - (current_line - window_offset)) - 1; i++) { terms[0]->get_cursor_pos(terms[0], &x, &y); set_cursor_pos_helper(terms[0]->cols - 1, y); - print(serial ? "|" : "\xb3"); + print(serial ? "|" : "│"); set_cursor_pos_helper(0, y + 1); - print(serial ? "|" : "\xb3"); + print(serial ? "|" : "│"); } terms[0]->get_cursor_pos(terms[0], &x, &y); set_cursor_pos_helper(terms[0]->cols - 1, y); - print(serial ? "|" : "\xb3"); + print(serial ? "|" : "│"); set_cursor_pos_helper(0, y + 1); - print(serial ? "\\" : "\xc0"); + print(serial ? "\\" : "└"); } for (size_t i = 0; i < terms[0]->cols - 2; i++) { switch (i) { case 1: case 2: case 3: if (current_line - window_offset >= window_size) { - print(serial ? "v" : "\x19"); + print(serial ? "v" : "↓"); break; } // FALLTHRU default: - print(serial ? "-" : "\xc4"); + print(serial ? "-" : "─"); } } terms[0]->get_cursor_pos(terms[0], &tmpx, &tmpy); - print(serial ? "/" : "\xd9"); + print(serial ? "/" : "┘"); set_cursor_pos_helper(0, tmpy + 1); if (display_overflow_error) { @@ -519,21 +519,21 @@ static size_t print_tree(size_t offset, size_t window, const char *shift, size_t for (size_t j = 0; j < i; j++) actual_parent = actual_parent->parent; if (actual_parent->next != NULL) { - if (!no_print) print(serial ? " |" : " \xb3"); + if (!no_print) print(serial ? " |" : " │"); } else { if (!no_print) print(" "); } } if (current_entry->next == NULL) { - if (!no_print) print(serial ? " `" : " \xc0"); + if (!no_print) print(serial ? " `" : " └"); } else { - if (!no_print) print(serial ? " |" : " \xc3"); + if (!no_print) print(serial ? " |" : " ├"); } } if (current_entry->sub) { if (!no_print) print(current_entry->expanded ? "[-]" : "[+]"); } else if (level) { - if (!no_print) print(serial ? "-> " : "\xc4> "); + if (!no_print) print(serial ? "-> " : "─> "); } else { if (!no_print) print(" "); } @@ -761,38 +761,38 @@ refresh: size_t x, y; terms[0]->get_cursor_pos(terms[0], &x, &y); - print(serial ? "/" : "\xda"); + print(serial ? "/" : "┌"); for (size_t i = 0; i < terms[0]->cols - 2; i++) { switch (i) { case 1: case 2: case 3: if (tree_offset > 0) { - print(serial ? "^" : "\x18"); break; + print(serial ? "^" : "↑"); break; } // FALLTHRU default: - print(serial ? "-" : "\xc4"); break; + print(serial ? "-" : "─"); break; } } - print(serial ? "\\" : "\xbf"); + print(serial ? "\\" : "┐"); for (size_t i = y + 1; i < terms[0]->rows - 2; i++) { set_cursor_pos_helper(0, i); - print(serial ? "|" : "\xb3"); + print(serial ? "|" : "│"); set_cursor_pos_helper(terms[0]->cols - 1, i); - print(serial ? "|" : "\xb3"); + print(serial ? "|" : "│"); } set_cursor_pos_helper(0, terms[0]->rows - 2); - print(serial ? "\\" : "\xc0"); + print(serial ? "\\" : "└"); for (size_t i = 0; i < terms[0]->cols - 2; i++) { - print(serial ? "-" : "\xc4"); + print(serial ? "-" : "─"); } - print(serial ? "/" : "\xd9"); + print(serial ? "/" : "┘"); set_cursor_pos_helper(x, y + 2); } - size_t max_entries = print_tree(tree_offset, terms[0]->rows - 10, serial ? "| " : "\xb3 ", 0, 0, selected_entry, menu_tree, + size_t max_entries = print_tree(tree_offset, terms[0]->rows - 10, serial ? "| " : "│ ", 0, 0, selected_entry, menu_tree, &selected_menu_entry); { @@ -801,7 +801,7 @@ refresh: if (tree_offset + (terms[0]->rows - 10) < max_entries) { set_cursor_pos_helper(2, terms[0]->rows - 2); - print(serial ? "vvv" : "\x19\x19\x19"); + print(serial ? "vvv" : "↓↓↓"); } set_cursor_pos_helper(0, 3); diff --git a/common/protos/limine.c b/common/protos/limine.c index 14a2aeb2..773ac88e 100644 --- a/common/protos/limine.c +++ b/common/protos/limine.c @@ -1133,7 +1133,6 @@ FEAT_END // Clear terminal for kernels that will use the Limine terminal FOR_TERM(flanterm_write(TERM, "\e[2J\e[H", 7)); - FOR_TERM(TERM->in_bootloader = false); #if defined (__x86_64__) || defined (__i386__) #if defined (BIOS)