summaryrefslogtreecommitdiffstats
path: root/ui/ncurses/nc-config.c
diff options
context:
space:
mode:
authorJeremy Kerr <jk@ozlabs.org>2014-04-15 11:08:39 +0800
committerJeremy Kerr <jk@ozlabs.org>2014-04-16 09:08:45 +0800
commit5171b1c54fc57b6f1963e2482cfc07587296100d (patch)
treeb118f2fdec869cd3b035e35a3c9b0fbc608753cc /ui/ncurses/nc-config.c
parentcf651e02fb7a34545211708c2a285cd228645531 (diff)
downloadtalos-petitboot-5171b1c54fc57b6f1963e2482cfc07587296100d.tar.gz
talos-petitboot-5171b1c54fc57b6f1963e2482cfc07587296100d.zip
ui/ncurses: Use a fixed-sized for small, known-length fields
Fields without O_STATIC can "scroll" horizontally, and we may miss a left-hand section of text from the current display. This can mean that the user can't leave a validated field with no indication why, if the off-to-the-left data is not a valid entry. This change adds a widgetset function to mark a field as fixed-size, so we don't have this scrolling behaviour. This means that the entire field contents will always be visible, and any validation errors can be seen. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Diffstat (limited to 'ui/ncurses/nc-config.c')
-rw-r--r--ui/ncurses/nc-config.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/ui/ncurses/nc-config.c b/ui/ncurses/nc-config.c
index f4fa073..3107c72 100644
--- a/ui/ncurses/nc-config.c
+++ b/ui/ncurses/nc-config.c
@@ -503,6 +503,7 @@ static void config_screen_setup_widgets(struct config_screen *screen,
screen->widgets.timeout_f = widget_new_textbox(set, 0, 0, 5, str);
screen->widgets.timeout_help_l = widget_new_label(set, 0, 0, "seconds");
+ widget_textbox_set_fixed_size(screen->widgets.timeout_f);
widget_textbox_set_validator_integer(screen->widgets.timeout_f, 0, 999);
screen->widgets.network_l = widget_new_label(set, 0, 0, "Network");
@@ -561,10 +562,12 @@ static void config_screen_setup_widgets(struct config_screen *screen,
screen->widgets.ip_addr_l = widget_new_label(set, 0, 0, "IP/mask:");
screen->widgets.ip_addr_f = widget_new_textbox(set, 0, 0, 16, ip);
screen->widgets.ip_mask_l = widget_new_label(set, 0, 0, "/");
- screen->widgets.ip_mask_f = widget_new_textbox(set, 0, 0, 4, mask);
+ screen->widgets.ip_mask_f = widget_new_textbox(set, 0, 0, 3, mask);
screen->widgets.ip_addr_mask_help_l =
widget_new_label(set, 0, 0, "(eg. 192.168.0.10 / 24)");
+ widget_textbox_set_fixed_size(screen->widgets.ip_addr_f);
+ widget_textbox_set_fixed_size(screen->widgets.ip_mask_f);
widget_textbox_set_validator_ipv4(screen->widgets.ip_addr_f);
widget_textbox_set_validator_integer(screen->widgets.ip_mask_f, 1, 31);
@@ -573,6 +576,7 @@ static void config_screen_setup_widgets(struct config_screen *screen,
screen->widgets.gateway_help_l =
widget_new_label(set, 0, 0, "(eg. 192.168.0.1)");
+ widget_textbox_set_fixed_size(screen->widgets.gateway_f);
widget_textbox_set_validator_ipv4(screen->widgets.gateway_f);
str = talloc_strdup(screen, "");
OpenPOWER on IntegriCloud