bootloader: fix duplicate "Autobooting in X seconds" line

The countdown row was derived as list_y - 4, which landed one row too low
(on the "Use Up/Down" line) instead of on the header line printed before the
loop. The in-loop countdown therefore rendered a second "Autobooting in X
seconds" copy directly below the static header, showing the phrase twice.

Capture the header's row with get_text_position() right before printing it, so
the loop updates that exact line in place — one countdown line, no stale copy.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Red Bear OS
2026-07-25 18:25:55 +09:00
parent f159a47f1c
commit 6407d28c26
+5 -1
View File
@@ -221,6 +221,11 @@ fn select_mode(
let mut countdown = AUTOBOOT_SECONDS;
let mut countdown_active = true;
// Capture the countdown line's row now, so the in-loop countdown updates it
// in place. Deriving it from list_y with a fixed offset landed one row too
// low (on the "Use Up/Down" line), leaving this header as a stale second
// "Autobooting in X seconds" copy above the live one.
let countdown_y = os.get_text_position().1;
os.set_text_color(TextColor::Yellow);
println!(
" Autobooting in {} seconds (press any key to cancel)",
@@ -240,7 +245,6 @@ fn select_mode(
println!();
let (list_x, list_y) = os.get_text_position();
let countdown_y = list_y.saturating_sub(4);
loop {
for (i, entry) in entries.iter().enumerate() {