From b6f99a457cb906277b172a0332a1e16ddba99228 Mon Sep 17 00:00:00 2001 From: Samuel Mendoza-Jonas Date: Wed, 9 Sep 2015 09:03:52 +1000 Subject: ui/ncurses: Allow text wrapping in select widgets Several string translations used in select widgets are longer than the maximum possible width of the widget. Rather than associating several FIELDs with a select option, use a fold_text callback to pad out substrings of the original string such that the ncurses O_WRAP option properly wraps strings within the field. Signed-off-by: Samuel Mendoza-Jonas --- ui/ncurses/nc-config.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'ui/ncurses/nc-config.c') diff --git a/ui/ncurses/nc-config.c b/ui/ncurses/nc-config.c index 7c02250..2750bbb 100644 --- a/ui/ncurses/nc-config.c +++ b/ui/ncurses/nc-config.c @@ -811,7 +811,8 @@ static void config_screen_setup_widgets(struct config_screen *screen, } screen->widgets.network_l = widget_new_label(set, 0, 0, _("Network:")); - screen->widgets.network_f = widget_new_select(set, 0, 0, 50); + screen->widgets.network_f = widget_new_select(set, 0, 0, + COLS - screen->field_x - 1); widget_select_add_option(screen->widgets.network_f, NET_CONF_TYPE_DHCP_ALL, @@ -908,11 +909,12 @@ static void config_screen_setup_widgets(struct config_screen *screen, screen->widgets.allow_write_l = widget_new_label(set, 0, 0, _("Disk R/W:")); screen->widgets.allow_write_f = widget_new_select(set, 0, 0, - COLS - screen->field_x); + COLS - screen->field_x - 1); widget_select_add_option(screen->widgets.allow_write_f, 0, _("Prevent all writes to disk"), !config->allow_writes); + widget_select_add_option(screen->widgets.allow_write_f, 1, _("Allow bootloader scripts to modify disks"), config->allow_writes); -- cgit v1.2.1