diff options
author | Jeremy Kerr <jk@ozlabs.org> | 2014-04-15 11:08:39 +0800 |
---|---|---|
committer | Jeremy Kerr <jk@ozlabs.org> | 2014-04-16 09:08:45 +0800 |
commit | 5171b1c54fc57b6f1963e2482cfc07587296100d (patch) | |
tree | b118f2fdec869cd3b035e35a3c9b0fbc608753cc /ui/ncurses/nc-widgets.c | |
parent | cf651e02fb7a34545211708c2a285cd228645531 (diff) | |
download | talos-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-widgets.c')
-rw-r--r-- | ui/ncurses/nc-widgets.c | 5 |
1 files changed, 5 insertions, 0 deletions
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) { |