| 1321 | } |
| 1322 | |
| 1323 | static void conf_choice(struct menu *menu) |
| 1324 | { |
| 1325 | const char *prompt = menu_get_prompt(menu); |
| 1326 | struct menu *child = NULL; |
| 1327 | struct symbol *active; |
| 1328 | struct property *prop; |
| 1329 | int selected_index = 0; |
| 1330 | int last_top_row = 0; |
| 1331 | int res, i = 0; |
| 1332 | struct match_state match_state = { |
| 1333 | .in_search = 0, |
| 1334 | .match_direction = MATCH_TINKER_PATTERN_DOWN, |
| 1335 | .pattern = "", |
| 1336 | }; |
| 1337 | |
| 1338 | active = sym_get_choice_value(menu->sym); |
| 1339 | /* this is mostly duplicated from the conf() function. */ |
| 1340 | while (!global_exit) { |
| 1341 | reset_menu(); |
| 1342 | |
| 1343 | for (i = 0, child = menu->list; child; child = child->next) { |
| 1344 | if (!show_all_items && !menu_is_visible(child)) |
| 1345 | continue; |
| 1346 | |
| 1347 | if (child->sym == sym_get_choice_value(menu->sym)) |
| 1348 | item_make(child, ':', "<X> %s", |
| 1349 | menu_get_prompt(child)); |
| 1350 | else if (child->sym) |
| 1351 | item_make(child, ':', " %s", |
| 1352 | menu_get_prompt(child)); |
| 1353 | else |
| 1354 | item_make(child, ':', "*** %s ***", |
| 1355 | menu_get_prompt(child)); |
| 1356 | |
| 1357 | if (child->sym == active){ |
| 1358 | last_top_row = top_row(curses_menu); |
| 1359 | selected_index = i; |
| 1360 | } |
| 1361 | i++; |
| 1362 | } |
| 1363 | show_menu(prompt ? prompt : "Choice Menu", |
| 1364 | radiolist_instructions, |
| 1365 | selected_index, |
| 1366 | &last_top_row); |
| 1367 | while (!global_exit) { |
| 1368 | if (match_state.in_search) { |
| 1369 | mvprintw(0, 0, "searching: %s", |
| 1370 | match_state.pattern); |
| 1371 | clrtoeol(); |
| 1372 | } |
| 1373 | refresh_all_windows(main_window); |
| 1374 | res = wgetch(menu_win(curses_menu)); |
| 1375 | if (!res) |
| 1376 | break; |
| 1377 | if (do_match(res, &match_state, &selected_index) == 0) { |
| 1378 | if (selected_index != -1) |
| 1379 | center_item(selected_index, |
| 1380 | &last_top_row); |
no test coverage detected