Skip to content

Commit

Permalink
[menu] Truncate menu title when necessary
Browse files Browse the repository at this point in the history
Modified-by: Michael Brown <mcb30@ipxe.org>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
  • Loading branch information
Christian Hesse authored and mcb30 committed Jul 3, 2012
1 parent 19859d8 commit b3adabd
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/hci/tui/menu_ui.c
Expand Up @@ -307,6 +307,7 @@ int show_menu ( struct menu *menu, unsigned int timeout_ms,
const char *select, struct menu_item **selected ) {
struct menu_item *item;
struct menu_ui ui;
char buf[ MENU_COLS + 1 /* NUL */ ];
int labelled_count = 0;
int rc;

Expand Down Expand Up @@ -348,8 +349,8 @@ int show_menu ( struct menu *menu, unsigned int timeout_ms,

/* Draw initial content */
attron ( A_BOLD );
mvprintw ( TITLE_ROW, ( ( COLS - strlen ( ui.menu->title ) ) / 2 ),
"%s", ui.menu->title );
snprintf ( buf, sizeof ( buf ), "%s", ui.menu->title );
mvprintw ( TITLE_ROW, ( ( COLS - strlen ( buf ) ) / 2 ), "%s", buf );
attroff ( A_BOLD );
draw_menu_items ( &ui );
draw_menu_item ( &ui, ui.selected );
Expand Down

0 comments on commit b3adabd

Please sign in to comment.