1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-12-25 01:20:37 +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"));
if(dialog::infix != "") mouseovers = dialog::infix;
vector<setting*> found;
dialog::start_list(900, 900, '1');
int found = 0;
for(auto& p: params) {
auto& fs = p.second;
string key = fs->search_key();
if(fs->available() && dialog::hasInfix(key))
found.push_back(&*fs);
if(fs->available() && dialog::hasInfix(key)) {
fs->show_edit_option(dialog::list_fake_key++);
found++;
}
}
for(int i=0; i<9; i++) {
if(i < isize(found)) {
found[i]->show_edit_option('1' + i);
}
else dialog::addBreak(100);
}
dialog::end_list();
dialog::addBreak(100);
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();
keyhandler = [] (int sym, int uni) {
dialog::handleNavigation(sym, uni);
if(dialog::editInfix(uni)) ;
@ -3347,6 +3346,9 @@ EX int read_config_args() {
else if(argis("-d:all")) {
PHASEFROM(2); launch_dialog(edit_all_settings);
}
else if(argis("-d:find")) {
PHASEFROM(2); launch_dialog(find_setting);
}
else if(argis("-char")) {
auto& cs = vid.cs;
shift();