| 1091 | } |
| 1092 | |
| 1093 | static void selected_conf(struct menu *menu, struct menu *active_menu) |
| 1094 | { |
| 1095 | struct menu *submenu = NULL; |
| 1096 | struct symbol *sym; |
| 1097 | int i, res; |
| 1098 | int current_index = 0; |
| 1099 | int last_top_row = 0; |
| 1100 | struct match_state match_state = { |
| 1101 | .in_search = 0, |
| 1102 | .match_direction = MATCH_TINKER_PATTERN_DOWN, |
| 1103 | .pattern = "", |
| 1104 | }; |
| 1105 | |
| 1106 | while (!global_exit) { |
| 1107 | reset_menu(); |
| 1108 | current_menu = menu; |
| 1109 | build_conf(menu); |
| 1110 | if (!child_count) |
| 1111 | break; |
| 1112 | |
| 1113 | if (active_menu != NULL) { |
| 1114 | for (i = 0; i < items_num; i++) { |
| 1115 | struct mitem *mcur; |
| 1116 | |
| 1117 | mcur = (struct mitem *) item_userptr(curses_menu_items[i]); |
| 1118 | if ((struct menu *) mcur->usrptr == active_menu) { |
| 1119 | current_index = i; |
| 1120 | break; |
| 1121 | } |
| 1122 | } |
| 1123 | active_menu = NULL; |
| 1124 | } |
| 1125 | |
| 1126 | show_menu(menu_get_prompt(menu), menu_instructions, |
| 1127 | current_index, &last_top_row); |
| 1128 | keypad((menu_win(curses_menu)), TRUE); |
| 1129 | while (!global_exit) { |
| 1130 | if (match_state.in_search) { |
| 1131 | mvprintw(0, 0, |
| 1132 | "searching: %s", match_state.pattern); |
| 1133 | clrtoeol(); |
| 1134 | } |
| 1135 | refresh_all_windows(main_window); |
| 1136 | res = wgetch(menu_win(curses_menu)); |
| 1137 | if (!res) |
| 1138 | break; |
| 1139 | if (do_match(res, &match_state, ¤t_index) == 0) { |
| 1140 | if (current_index != -1) |
| 1141 | center_item(current_index, |
| 1142 | &last_top_row); |
| 1143 | continue; |
| 1144 | } |
| 1145 | if (process_special_keys(&res, |
| 1146 | (struct menu *) item_data())) |
| 1147 | break; |
| 1148 | switch (res) { |
| 1149 | case KEY_DOWN: |
| 1150 | case 'j': |
no test coverage detected