[syslinux:elflink] menu: Make "menu clear" the default

syslinux-bot for H. Peter Anvin hpa at zytor.com
Tue Mar 27 14:45:04 PDT 2012


Commit-ID:  6ab02b6682c0b693b3e4f9afcc2ab8775f804f0a
Gitweb:     http://www.syslinux.org/commit/6ab02b6682c0b693b3e4f9afcc2ab8775f804f0a
Author:     H. Peter Anvin <hpa at zytor.com>
AuthorDate: Tue, 27 Mar 2012 14:39:46 -0700
Committer:  H. Peter Anvin <hpa at zytor.com>
CommitDate: Tue, 27 Mar 2012 14:39:46 -0700

menu: Make "menu clear" the default

Make "menu clear" the default... it was sort of implicitly so at least
for vesamenu when using the old system, since we would end up zapping
the mode when any output happened, but that no longer is the case.

Also move the cursor to the top of the screen.

Signed-off-by: H. Peter Anvin <hpa at zytor.com>

---
 com32/menu/menumain.c   |   10 +++++++---
 com32/menu/readconfig.c |    4 +++-
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/com32/menu/menumain.c b/com32/menu/menumain.c
index 5b3f6bd..a795cb2 100644
--- a/com32/menu/menumain.c
+++ b/com32/menu/menumain.c
@@ -1108,7 +1108,7 @@ int main(int argc, char *argv[])
 {
     const char *cmdline;
     struct menu *m;
-    int rows, cols;
+    int rows, cols, cursorrow;
     int i;
 
     (void)argc;
@@ -1150,11 +1150,15 @@ int main(int argc, char *argv[])
 	local_cursor_enable(true);
 	cmdline = run_menu();
 
-	if (clearmenu)
+	if (clearmenu) {
 	    clear_screen();
+	    cursorrow = 1;
+	} else {
+	    cursorrow = END_ROW;
+	}
 
 	local_cursor_enable(false);
-	printf("\033[?25h\033[%d;1H\033[0m", END_ROW);
+	printf("\033[?25h\033[%d;1H\033[0m", cursorrow);
 
 	if (cmdline) {
 	    execute(cmdline, KT_NONE);
diff --git a/com32/menu/readconfig.c b/com32/menu/readconfig.c
index 0ac2564..8f9d237 100644
--- a/com32/menu/readconfig.c
+++ b/com32/menu/readconfig.c
@@ -35,7 +35,7 @@ struct menu *root_menu, *start_menu, *hide_menu, *menu_list;
 /* These are global parameters regardless of which menu we're displaying */
 int shiftkey = 0;		/* Only display menu if shift key pressed */
 int hiddenmenu = 0;
-int clearmenu = 0;
+int clearmenu = 1;
 long long totaltimeout = 0;
 const char *hide_key[KEY_MAX];
 
@@ -744,6 +744,8 @@ static void parse_config_file(FILE * f)
 		refstr_put(command);
 	    } else if ((ep = looking_at(p, "clear"))) {
 		clearmenu = 1;
+	    } else if ((ep = looking_at(p, "noclear"))) {
+		clearmenu = 0;
 	    } else if ((ep = is_message_name(p, &msgnr))) {
 		refstr_put(m->messages[msgnr]);
 		m->messages[msgnr] = refstrdup(skipspace(ep));


More information about the Syslinux-commits mailing list