From d56f23544c25dfde79e5c060b0951f47151fb63c Mon Sep 17 00:00:00 2001 From: Sergio Valor Date: Wed, 24 Sep 2025 20:46:07 +0200 Subject: [PATCH] corregit menu_renderer.cpp, de vegades es modificava el ample del menu al canviar les opcions --- source/ui/menu_renderer.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/source/ui/menu_renderer.cpp b/source/ui/menu_renderer.cpp index 0bfe342..acced61 100644 --- a/source/ui/menu_renderer.cpp +++ b/source/ui/menu_renderer.cpp @@ -324,8 +324,17 @@ void MenuRenderer::precalculateMenuWidths(const std::vectorlength(option->getCaption(), -2)); if (menu_state->getCurrentGroupAlignment() == ServiceMenu::GroupAlignment::LEFT) { + // Usar getMaxValueWidth() para considerar TODOS los valores posibles de la opción + int option_max_value_width = option->getMaxValueWidth(element_text_.get()); int max_available_value_width = static_cast(max_menu_width_) - max_option_width - (ServiceMenu::OPTIONS_HORIZONTAL_PADDING * 2) - ServiceMenu::MIN_GAP_OPTION_VALUE; - max_value_width = std::max(max_value_width, getTruncatedValueWidth(option->getValueAsString(), max_available_value_width)); + + if (option_max_value_width <= max_available_value_width) { + // Si el valor más largo cabe, usar su ancho real + max_value_width = std::max(max_value_width, option_max_value_width); + } else { + // Si no cabe, usar el ancho disponible (será truncado) + max_value_width = std::max(max_value_width, max_available_value_width); + } } } size_t total_width = max_option_width + (ServiceMenu::OPTIONS_HORIZONTAL_PADDING * 2);