From 6b8c177c336fd013f8f300e1407a76dfbc0339ba Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Fri, 21 Oct 2022 11:30:51 +0200 Subject: [PATCH] dialog:: list used in find_setting --- config.cpp | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/config.cpp b/config.cpp index 56597927..95e24363 100644 --- a/config.cpp +++ b/config.cpp @@ -2966,28 +2966,27 @@ EX void find_setting() { dialog::init(XLAT("find a setting")); if(dialog::infix != "") mouseovers = dialog::infix; - - vector 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();