:: commit 105e90f447f9bbfaf788794e7b2426482dc9c9ec

mintsuki <mintsuki@protonmail.com> — 2022-09-18 09:52

parents: e0b9f99771

menu: Avoid reinitialising fallback terminal on first runs

diff --git a/common/menu.c b/common/menu.c
index e79b4cf0..db41cf67 100644
--- a/common/menu.c
+++ b/common/menu.c
@@ -551,7 +551,7 @@ extern symbol s2_data_begin;
 extern symbol s2_data_end;
 #endif
 
-noreturn void _menu(bool timeout_enabled) {
+noreturn void _menu(bool first_run) {
     size_t data_size = (uintptr_t)data_end - (uintptr_t)data_begin;
 #if defined (BIOS)
     size_t s2_data_size = (uintptr_t)s2_data_end - (uintptr_t)s2_data_begin;
@@ -578,7 +578,9 @@ noreturn void _menu(bool timeout_enabled) {
 #endif
     }
 
-    term_fallback();
+    if (!first_run) {
+        term_fallback();
+    }
 
     if (bad_config == false) {
         volume_iterate_parts(boot_volume,
@@ -641,7 +643,7 @@ noreturn void _menu(bool timeout_enabled) {
             timeout = strtoui(timeout_config, NULL, 10);
     }
 
-    if (!timeout_enabled) {
+    if (!first_run) {
         skip_timeout = true;
     }
 
diff --git a/common/menu.h b/common/menu.h
index 73f8a5b5..35a3ff73 100644
--- a/common/menu.h
+++ b/common/menu.h
@@ -4,7 +4,7 @@
 #include <stdbool.h>
 #include <stdnoreturn.h>
 
-noreturn void menu(bool timeout_enabled);
+noreturn void menu(bool first_run);
 
 noreturn void boot(char *config);
 
tab: 248 wrap: offon