From 5171b1c54fc57b6f1963e2482cfc07587296100d Mon Sep 17 00:00:00 2001 From: Jeremy Kerr Date: Tue, 15 Apr 2014 11:08:39 +0800 Subject: 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 --- ui/ncurses/nc-widgets.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'ui/ncurses/nc-widgets.c') diff --git a/ui/ncurses/nc-widgets.c b/ui/ncurses/nc-widgets.c index 2829040..bd78927 100644 --- a/ui/ncurses/nc-widgets.c +++ b/ui/ncurses/nc-widgets.c @@ -353,6 +353,11 @@ struct nc_widget_textbox *widget_new_textbox(struct nc_widgetset *set, return textbox; } +void widget_textbox_set_fixed_size(struct nc_widget_textbox *textbox) +{ + field_opts_on(textbox->widget.field, O_STATIC); +} + void widget_textbox_set_validator_integer(struct nc_widget_textbox *textbox, long min, long max) { -- cgit v1.2.1