From 95c3a2c6911ac0472439b9da44c4e9383c375b4c Mon Sep 17 00:00:00 2001 From: Andy Beverley Date: Tue, 31 Dec 2013 10:29:21 +0000 Subject: [PATCH] Fix missing footer on narrow screens --- src/gui.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/gui.c b/src/gui.c index 6ea72de..2240e6b 100644 --- a/src/gui.c +++ b/src/gui.c @@ -123,7 +123,7 @@ const char* options_title = " Options "; const char* stats_title = " Statistics "; /* Footer labels. */ -const char* nwipe_buttons1 = " P=PRNG M=Method V=Verify R=Rounds B=Blanking-pass, J=Up K=Down Space=Select, F10=Start, ctrl-c=Quit "; +const char* nwipe_buttons1 = "Ctrl-C=Quit F10=Start M=Method P=PRNG V=Verify R=Rounds B=Blanking-pass Space=Select"; const char* nwipe_buttons2 = " J=Up K=Down Space=Select"; const char* nwipe_buttons3 = " B=Blank screen, ctrl-c=Quit"; @@ -144,9 +144,13 @@ void nwipe_gui_title( WINDOW* w, const char* s ) /* Get the window dimensions. */ getmaxyx( w, wy, wx ); - + + /*Calculate available total margin */ + int margin = (wx - strlen( s )); + if (margin < 0) margin = 0; + /* Print the title. */ - mvwprintw( w, 0, ( wx - strlen( s ) ) / 2, "%s", s ); + mvwprintw( w, 0, margin / 2, "%s", s ); } /* nwipe_gui_title */