[syslinux:master] menu: when running hidden, clear the screen before final boot
syslinux-bot for H. Peter Anvin
hpa at zytor.com
Wed Feb 3 16:00:05 PST 2010
Commit-ID: 8276fe64e083725e406d48c596e4a43cb5927daa
Gitweb: http://syslinux.zytor.com/commit/8276fe64e083725e406d48c596e4a43cb5927daa
Author: H. Peter Anvin <hpa at zytor.com>
AuthorDate: Wed, 3 Feb 2010 15:55:47 -0800
Committer: H. Peter Anvin <hpa at zytor.com>
CommitDate: Wed, 3 Feb 2010 15:56:44 -0800
menu: when running hidden, clear the screen before final boot
Clear away the countdown message before actually running the final
boot.
Signed-off-by: H. Peter Anvin <hpa at zytor.com>
---
com32/menu/menumain.c | 22 +++++++++++++++++-----
1 files changed, 17 insertions(+), 5 deletions(-)
diff --git a/com32/menu/menumain.c b/com32/menu/menumain.c
index cbeb9a1..9516f72 100644
--- a/com32/menu/menumain.c
+++ b/com32/menu/menumain.c
@@ -1,7 +1,7 @@
/* ----------------------------------------------------------------------- *
*
* Copyright 2004-2008 H. Peter Anvin - All Rights Reserved
- * Copyright 2009 Intel Corporation; author: H. Peter Anvin
+ * Copyright 2009-2010 Intel Corporation; author: H. Peter Anvin
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -616,8 +616,9 @@ static inline int shift_is_held(void)
static void print_timeout_message(int tol, int row, const char *msg)
{
+ static int last_msg_len = 0;
char buf[256];
- int nc = 0, nnc;
+ int nc = 0, nnc, padc;
const char *tp = msg;
char tc;
char *tq = buf;
@@ -686,9 +687,17 @@ static void print_timeout_message(int tol, int row, const char *msg)
}
*tq = '\0';
- /* Let's hope 4 spaces on each side is enough... */
- printf("\033[%d;%dH\2#14 %s ", row,
- HSHIFT + 1 + ((WIDTH - nc - 8) >> 1), buf);
+ if (nc >= last_msg_len) {
+ padc = 0;
+ } else {
+ padc = (last_msg_len - nc + 1) >> 1;
+ }
+
+ printf("\033[%d;%dH\2#14%*s%s%*s", row,
+ HSHIFT + 1 + ((WIDTH - nc) >> 1) - padc,
+ padc, "", buf, padc, "");
+
+ last_msg_len = nc;
}
/* Set the background screen, etc. */
@@ -724,6 +733,9 @@ static const char *do_hidden_menu(void)
}
}
+ /* Clear the message from the screen */
+ print_timeout_message(0, HIDDEN_ROW, "");
+
if (cm->ontimeout)
return cm->ontimeout;
else
More information about the Syslinux-commits
mailing list