From dbfb088630b7d81c6b261413aa8f3c6cb370b819 Mon Sep 17 00:00:00 2001 From: Martin Michelsen Date: Mon, 26 Dec 2022 10:22:16 -0800 Subject: [PATCH] sort proxy destinations by name --- src/ServerState.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/ServerState.cc b/src/ServerState.cc index f9d22281..7cfcb38a 100644 --- a/src/ServerState.cc +++ b/src/ServerState.cc @@ -390,7 +390,11 @@ void ServerState::create_menus(shared_ptr config_json) { vector>& ret_pds, const char* key) { try { - const auto& items = d.at(key); + map> sorted_jsons; + for (const auto& it : d.at(key)->as_dict()) { + sorted_jsons.emplace(it.first, it.second); + } + ret_menu.clear(); ret_pds.clear(); @@ -400,7 +404,7 @@ void ServerState::create_menus(shared_ptr config_json) { u"Set proxy options", 0); uint32_t item_id = 0; - for (const auto& item : items->as_dict()) { + for (const auto& item : sorted_jsons) { const string& netloc_str = item.second->as_string(); const string& description = "$C7Remote server:\n$C6" + netloc_str; ret_menu.emplace_back(item_id, decode_sjis(item.first),