]> git.ozlabs.org Git - petitboot/blobdiff - ui/ncurses/nc-scr.c
discover/grub2: Allow to separate the --id argument using a space char
[petitboot] / ui / ncurses / nc-scr.c
index e8c5fcabc1b783b46ba051c1db45ec415a50b329..e95c0ea361e893dae68b14fb2d0fcb4e8d04e208 100644 (file)
@@ -16,9 +16,9 @@
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
+#if defined(HAVE_CONFIG_H)
 #include "config.h"
-
-#define _GNU_SOURCE
+#endif
 
 #include <assert.h>
 #include <stdarg.h>
@@ -36,8 +36,8 @@ static void nc_scr_status_clear(struct nc_scr *scr)
 
 static void nc_scr_status_draw(struct nc_scr *scr)
 {
-       mvwaddstr(scr->main_ncw, LINES - nc_scr_pos_status, 1,
-               scr->frame.status);
+       mvwaddnstr(scr->main_ncw, LINES - nc_scr_pos_status, 1,
+               scr->frame.status, COLS);
 }
 
 int nc_scr_post(struct nc_scr *scr)
@@ -56,7 +56,7 @@ int nc_scr_unpost(struct nc_scr *scr)
 
 void nc_scr_frame_draw(struct nc_scr *scr)
 {
-       int ltitle_len, rtitle_len;
+       int ltitle_len, rtitle_len, help_len;
 
        DBGS("ltitle '%s'\n", scr->frame.ltitle);
        DBGS("rtitle '%s'\n", scr->frame.rtitle);
@@ -77,6 +77,10 @@ void nc_scr_frame_draw(struct nc_scr *scr)
 
        mvwhline(scr->main_ncw, LINES - nc_scr_pos_help_sep, 1, ACS_HLINE,
                COLS - 2);
+       help_len = 1 + strlen(scr->frame.help);
+       if (help_len < COLS)
+               mvwhline(scr->main_ncw, LINES - nc_scr_pos_help, help_len, ' ',
+                               COLS - help_len);
        mvwaddstr(scr->main_ncw, LINES - nc_scr_pos_help, 1, scr->frame.help);
        nc_scr_status_draw(scr);
 }
@@ -128,7 +132,7 @@ int nc_scr_init(struct nc_scr *scr, enum pb_nc_sig sig, int begin_x,
 
        scr->sub_ncw = derwin(scr->main_ncw,
                LINES - nc_scr_frame_lines,
-               COLS - 1 - begin_x,
+               COLS - nc_scr_frame_cols - begin_x,
                nc_scr_pos_sub,
                begin_x);