From 17a4fcefdea44f6502f412415de4aa075d38762b Mon Sep 17 00:00:00 2001 From: Peter Nelson Date: Thu, 20 Feb 2025 21:26:26 +0000 Subject: [PATCH] Fix: League table window ignored the minimal size in its widget description. --- src/league_gui.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/league_gui.cpp b/src/league_gui.cpp index 2f4028ce4d..cbc8677d3a 100644 --- a/src/league_gui.cpp +++ b/src/league_gui.cpp @@ -384,8 +384,12 @@ public: if (!show_icon_column) this->icon_size.width = 0; else this->icon_size.width += WidgetDimensions::scaled.hsep_wide; - size.width = this->rank_width + this->icon_size.width + this->text_width + this->score_width + WidgetDimensions::scaled.framerect.Horizontal() + WidgetDimensions::scaled.hsep_wide * 2; - size.height = this->line_height * std::max(3u, (unsigned)this->rows.size()) + WidgetDimensions::scaled.framerect.Vertical(); + uint non_text_width = this->rank_width + this->icon_size.width + this->score_width + WidgetDimensions::scaled.framerect.Horizontal() + WidgetDimensions::scaled.hsep_wide * 2; + size.width = std::max(size.width, non_text_width + this->text_width); + size.height = std::max(size.height, this->line_height * std::max(3u, (unsigned)this->rows.size()) + WidgetDimensions::scaled.framerect.Vertical()); + + /* Adjust text_width to fill any space left over if the preset minimal width is larger than our calculated width. */ + this->text_width = size.width - non_text_width; if (!lt->header.empty()) { SetDParamStr(0, lt->header);