From 984b41a1ae67ee2d61085bfac0a48b95b14326e9 Mon Sep 17 00:00:00 2001 From: bicarus-dev <202771338+bicarus-dev@users.noreply.github.com> Date: Sun, 30 Nov 2025 01:59:25 -0800 Subject: [PATCH] cfg: fix combo boxes (#429) ## Link to GitHub Issue, if one exists n/a ## Description of change Combo boxes for options were not highlighting the currently selected item. Also, when there were no description provided for an option, it was still showing the empty `()` in the selected value. ## Testing --- src/spice2x/overlay/windows/config.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/spice2x/overlay/windows/config.cpp b/src/spice2x/overlay/windows/config.cpp index 91be1cf..7e43b07 100644 --- a/src/spice2x/overlay/windows/config.cpp +++ b/src/spice2x/overlay/windows/config.cpp @@ -2828,7 +2828,10 @@ namespace overlay::windows { std::string current_item = option.value_text(); for (auto &element : definition.elements) { if (element.first == current_item) { - current_item += fmt::format(" ({})", element.second); + if (!element.second.empty()) { + current_item += fmt::format(" ({})", element.second); + } + break; } } if (current_item.empty()) { @@ -2836,11 +2839,12 @@ namespace overlay::windows { } if (ImGui::BeginCombo("##combo", current_item.c_str(), 0)) { for (auto &element : definition.elements) { - bool selected = current_item == element.first; std::string label = element.first; if (!element.second.empty()) { label += fmt::format(" ({})", element.second); } + + bool selected = current_item == label; if (ImGui::Selectable(label.c_str(), selected)) { this->options_dirty = true; option.value = element.first;