From 8e2d333130de2c2088e873d9edbd1feddefdb4b5 Mon Sep 17 00:00:00 2001 From: Jon Kazama Date: Tue, 16 Jun 2026 00:24:18 +0200 Subject: [PATCH] fix(toptab): size each tab selectable to its label width --- HellionChat/Ui/Components/TopTabBar.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/HellionChat/Ui/Components/TopTabBar.cs b/HellionChat/Ui/Components/TopTabBar.cs index 767417f..5010335 100644 --- a/HellionChat/Ui/Components/TopTabBar.cs +++ b/HellionChat/Ui/Components/TopTabBar.cs @@ -25,12 +25,17 @@ internal sealed class TopTabBar ImGui.SameLine(); var selected = ReferenceEquals(tab, activeTab); + // Size the selectable to its own label width. A zero width makes ImGui + // stretch the selectable's box to the full remaining window width + // (imgui_widgets.cpp:7378), so in this SameLine row every tab overlaps + // into one giant bar and clicking never lands on the intended tab. + var tabWidth = ImGui.CalcTextSize(tab.Name).X; if ( ImGui.Selectable( $"{tab.Name}###hellion_toptab_{i}", selected, ImGuiSelectableFlags.None, - new Vector2(0, 0) + new Vector2(tabWidth, 0) ) ) {