diff options
Diffstat (limited to 'scripts/config/checklist.c')
-rw-r--r-- | scripts/config/checklist.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/scripts/config/checklist.c b/scripts/config/checklist.c index 9744d798d..4dbd16616 100644 --- a/scripts/config/checklist.c +++ b/scripts/config/checklist.c | |||
@@ -138,10 +138,12 @@ dialog_checklist (const char *title, const char *prompt, int height, int width, | |||
138 | 138 | ||
139 | /* Initializes status */ | 139 | /* Initializes status */ |
140 | for (i = 0; i < item_no; i++) { | 140 | for (i = 0; i < item_no; i++) { |
141 | status[i] = items[i]->selected; | 141 | status[i] = (items[i]->selected == 1); /* ON */ |
142 | if (!choice && status[i]) | 142 | if ((!choice && status[i]) || items[i]->selected == 2) /* SELECTED */ |
143 | choice = i; | 143 | choice = i + 1; |
144 | } | 144 | } |
145 | if (choice) | ||
146 | choice--; | ||
145 | 147 | ||
146 | max_choice = MIN (list_height, item_no); | 148 | max_choice = MIN (list_height, item_no); |
147 | 149 | ||
@@ -303,6 +305,9 @@ dialog_checklist (const char *title, const char *prompt, int height, int width, | |||
303 | case 'H': | 305 | case 'H': |
304 | case 'h': | 306 | case 'h': |
305 | case '?': | 307 | case '?': |
308 | for (i = 0; i < item_no; i++) | ||
309 | items[i]->selected = 0; | ||
310 | items[scroll + choice]->selected = 1; | ||
306 | delwin (dialog); | 311 | delwin (dialog); |
307 | free (status); | 312 | free (status); |
308 | return 1; | 313 | return 1; |
@@ -341,7 +346,11 @@ dialog_checklist (const char *title, const char *prompt, int height, int width, | |||
341 | for (i = 0; i < item_no; i++) { | 346 | for (i = 0; i < item_no; i++) { |
342 | items[i]->selected = status[i]; | 347 | items[i]->selected = status[i]; |
343 | } | 348 | } |
344 | } | 349 | } else { |
350 | for (i = 0; i < item_no; i++) | ||
351 | items[i]->selected = 0; | ||
352 | items[scroll + choice]->selected = 1; | ||
353 | } | ||
345 | delwin (dialog); | 354 | delwin (dialog); |
346 | free (status); | 355 | free (status); |
347 | return button; | 356 | return button; |