From 76e29141ce80d7e6bf1f9e8286306d1eed15b883 Mon Sep 17 00:00:00 2001 From: Andrew Pamment Date: Thu, 14 Sep 2017 19:37:48 +1000 Subject: [PATCH] Add CLEARSCREEN option to menus --- menus.c | 12 ++++++++++-- menus_default/logoff.mnu | 1 + 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/menus.c b/menus.c index e2f1d4e..729d480 100644 --- a/menus.c +++ b/menus.c @@ -74,6 +74,7 @@ int menu_system(char *menufile) { int result; int doquit = 0; char c; + int clearscreen = 0; if (menufile[0] == '/') { snprintf(buffer, PATH_MAX, "%s.mnu", menufile); @@ -201,7 +202,9 @@ int menu_system(char *menufile) { free(ansi_file); } ansi_file = strdup(&buffer[9]); - } + } else if (strncasecmp(buffer, "CLEARSCREEN", 11) == 0) { + clearscreen = 1; + } fgets(buffer, 256, fptr); } @@ -259,6 +262,11 @@ int menu_system(char *menufile) { } } } + + if (clearscreen) { + s_printf("\e[2J\e[1;1H"); + } + if (do_lua_menu == 0) { if (ansi_file != NULL) { s_displayansi(ansi_file); @@ -471,4 +479,4 @@ int menu_system(char *menufile) { // free menus; return doquit; -} \ No newline at end of file +} diff --git a/menus_default/logoff.mnu b/menus_default/logoff.mnu index 27eb5c2..bf69e0f 100644 --- a/menus_default/logoff.mnu +++ b/menus_default/logoff.mnu @@ -1,4 +1,5 @@ ANSIFILE logoff +CLEARSCREEN HOTKEY Y COMMAND LOGOFF