summaryrefslogtreecommitdiff
path: root/extra/config/checklist.c
diff options
context:
space:
mode:
Diffstat (limited to 'extra/config/checklist.c')
-rw-r--r--extra/config/checklist.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/extra/config/checklist.c b/extra/config/checklist.c
index c4a9289b9..71de4a191 100644
--- a/extra/config/checklist.c
+++ b/extra/config/checklist.c
@@ -138,10 +138,12 @@ dialog_checklist (const char *title, const char *prompt, int height, int width,
/* Initializes status */
for (i = 0; i < item_no; i++) {
- status[i] = items[i]->selected;
- if (!choice && status[i])
- choice = i;
+ status[i] = (items[i]->selected == 1); /* ON */
+ if ((!choice && status[i]) || items[i]->selected == 2) /* SELECTED */
+ choice = i + 1;
}
+ if (choice)
+ choice--;
max_choice = MIN (list_height, item_no);
@@ -303,6 +305,9 @@ dialog_checklist (const char *title, const char *prompt, int height, int width,
case 'H':
case 'h':
case '?':
+ for (i = 0; i < item_no; i++)
+ items[i]->selected = 0;
+ items[scroll + choice]->selected = 1;
delwin (dialog);
free (status);
return 1;
@@ -341,7 +346,11 @@ dialog_checklist (const char *title, const char *prompt, int height, int width,
for (i = 0; i < item_no; i++) {
items[i]->selected = status[i];
}
- }
+ } else {
+ for (i = 0; i < item_no; i++)
+ items[i]->selected = 0;
+ items[scroll + choice]->selected = 1;
+ }
delwin (dialog);
free (status);
return button;