Michael Brown <[email protected]> on Tue, 2012/07/03 14:21:
> On Thursday 28 Jun 2012 11:26:41 Christian Hesse wrote:
> > I have sent this to the list about two month ago, but as the last patch
> > was neither committed nor commented I am resending.
> > 
> > This truncates menu title when it is longer than menu width. Otherwise no
> > title is displayed at all in this case.
> > 
> > This has been reworked to not touch the menu code but handle the
> > truncation within ui code instead.
> 
> Applied, with some modifications:
> 
>   http://git.ipxe.org/ipxe.git/commitdiff/b3adabd
> 
> Thanks, and sorry for the delay.

Sorry, but this does not work... MENU_COLS + 1 is too much, the string is
truncated but it is still not shown as it is one byte too long.

I would suggest the attached patch, this leaves a blank left and right of the
menu title.
This is like menu items behave, they always have a blank at the end as well.
-- 
main(a,b){char*/*    Schoene Gruesse                         */c="B?IJj;M"
"EHCX:;";for(a/*    Chris           get my mail address:    */=0;b=c[a++];)
putchar(b-1/(/*               gcc -o sig sig.c && ./sig    */b/42*2-3)*42);}
diff --git a/src/hci/tui/menu_ui.c b/src/hci/tui/menu_ui.c
index e925009..a2dadd4 100644
--- a/src/hci/tui/menu_ui.c
+++ b/src/hci/tui/menu_ui.c
@@ -307,7 +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 */ ];
+	char buf[ MENU_COLS - 1 /* one blank left and right + NUL */ ];
 	int labelled_count = 0;
 	int rc;
 
_______________________________________________
ipxe-devel mailing list
[email protected]
https://lists.ipxe.org/mailman/listinfo.cgi/ipxe-devel

Reply via email to