From e33a95f6ab979c2fcd45e11f59e3b9648126fd5e Mon Sep 17 00:00:00 2001 From: Michael Alexsander Date: Tue, 14 Jan 2025 12:13:04 -0300 Subject: [PATCH] Always pick widest style as min width between unselected and hovered in `TabBar` --- scene/gui/tab_bar.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scene/gui/tab_bar.cpp b/scene/gui/tab_bar.cpp index e8ff6420018..65e3d23c0bf 100644 --- a/scene/gui/tab_bar.cpp +++ b/scene/gui/tab_bar.cpp @@ -1488,8 +1488,8 @@ int TabBar::get_tab_width(int p_idx) const { style = theme_cache.tab_disabled_style; } else if (current == p_idx) { style = theme_cache.tab_selected_style; - // Use the unselected style's width if the hovered one is shorter, to avoid an infinite loop when switching tabs with the mouse. - } else if (hover == p_idx && theme_cache.tab_hovered_style->get_minimum_size().width >= theme_cache.tab_unselected_style->get_minimum_size().width) { + // Always pick the widest style between hovered and unselected, to avoid an infinite loop when switching tabs with the mouse. + } else if (theme_cache.tab_hovered_style->get_minimum_size().width > theme_cache.tab_unselected_style->get_minimum_size().width) { style = theme_cache.tab_hovered_style; } else { style = theme_cache.tab_unselected_style;