summaryrefslogtreecommitdiffstats
path: root/ui/ncurses/nc-widgets.c
diff options
context:
space:
mode:
authorSamuel Mendoza-Jonas <sam@mendozajonas.com>2016-07-13 16:43:22 +1000
committerSamuel Mendoza-Jonas <sam@mendozajonas.com>2016-07-13 16:50:30 +1000
commit8ede209928e7bf7c06a11eee9c51a551193ba8e9 (patch)
treee862ff6c2515f1d6ae899e787a2915f4611ee4f6 /ui/ncurses/nc-widgets.c
parent96f9b8cd29dae248838d4221f3cb1c38e3aa1396 (diff)
downloadtalos-petitboot-8ede209928e7bf7c06a11eee9c51a551193ba8e9.tar.gz
talos-petitboot-8ede209928e7bf7c06a11eee9c51a551193ba8e9.zip
ui/ncurses: Properly set focus when updating subset
When a subset widget is made empty focus is switched to the first visible field. It should actually be set to the first visible and active field, otherwise we can try to focus an un-selectable label. While we're here, also properly set the visibility for the autoboot enable/disable widget. Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
Diffstat (limited to 'ui/ncurses/nc-widgets.c')
-rw-r--r--ui/ncurses/nc-widgets.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/ui/ncurses/nc-widgets.c b/ui/ncurses/nc-widgets.c
index 50909ab..8f8816e 100644
--- a/ui/ncurses/nc-widgets.c
+++ b/ui/ncurses/nc-widgets.c
@@ -466,6 +466,7 @@ static void subset_delete_active(struct nc_widget_subset *subset, int idx)
struct nc_widget *widget;
size_t rem;
int i, val;
+ uint32_t opts;
/* Shift field focus to nearest active option or next visible field */
if (subset->n_active > 1) {
@@ -477,8 +478,11 @@ static void subset_delete_active(struct nc_widget_subset *subset, int idx)
} else {
for (i = 0; i < set->n_fields; i++)
if (field_visible(set->fields[i])) {
- set->cur_field = set->fields[i];
- break;
+ opts = field_opts(set->fields[i]);
+ if ((opts & O_ACTIVE) == O_ACTIVE) {
+ set->cur_field = set->fields[i];
+ break;
+ }
}
}
OpenPOWER on IntegriCloud