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) ) ) {