1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-11-10 15:59:53 +00:00

dialog:: list used in find_setting

This commit is contained in:
Zeno Rogue 2022-10-21 11:30:51 +02:00
parent bbbf2f9cd0
commit 6b8c177c33

View File

@ -2966,28 +2966,27 @@ EX void find_setting() {
dialog::init(XLAT("find a setting")); dialog::init(XLAT("find a setting"));
if(dialog::infix != "") mouseovers = dialog::infix; if(dialog::infix != "") mouseovers = dialog::infix;
vector<setting*> found; dialog::start_list(900, 900, '1');
int found = 0;
for(auto& p: params) { for(auto& p: params) {
auto& fs = p.second; auto& fs = p.second;
string key = fs->search_key(); string key = fs->search_key();
if(fs->available() && dialog::hasInfix(key)) if(fs->available() && dialog::hasInfix(key)) {
found.push_back(&*fs); fs->show_edit_option(dialog::list_fake_key++);
found++;
}
} }
for(int i=0; i<9; i++) { dialog::end_list();
if(i < isize(found)) {
found[i]->show_edit_option('1' + i);
}
else dialog::addBreak(100);
}
dialog::addBreak(100); dialog::addBreak(100);
dialog::addInfo(XLAT("press letters to search")); dialog::addInfo(XLAT("press letters to search"));
dialog::addSelItem(XLAT("matching items"), its(isize(found)), 0); dialog::addSelItem(XLAT("matching items"), its(found), 0);
dialog::display(); dialog::display();
keyhandler = [] (int sym, int uni) { keyhandler = [] (int sym, int uni) {
dialog::handleNavigation(sym, uni); dialog::handleNavigation(sym, uni);
if(dialog::editInfix(uni)) ; if(dialog::editInfix(uni)) ;
@ -3347,6 +3346,9 @@ EX int read_config_args() {
else if(argis("-d:all")) { else if(argis("-d:all")) {
PHASEFROM(2); launch_dialog(edit_all_settings); PHASEFROM(2); launch_dialog(edit_all_settings);
} }
else if(argis("-d:find")) {
PHASEFROM(2); launch_dialog(find_setting);
}
else if(argis("-char")) { else if(argis("-char")) {
auto& cs = vid.cs; auto& cs = vid.cs;
shift(); shift();