From 464bd528876e16740c0260a6f7843807b4688645 Mon Sep 17 00:00:00 2001 From: Jon Kazama Date: Mon, 17 Aug 2026 23:49:15 +0200 Subject: [PATCH] refactor(sidebar): move section headers onto the divider widget Separator plus TextDisabled took all of their vertical breathing room from ItemSpacing. The next task pushes ItemSpacing to zero so rows sit flush, which would have collapsed the header onto its neighbours. LineDivider carries its own padding and submits its own layout item, so it no longer depends on the surrounding spacing at all. The compact branch keeps suppressing only the caption, and LastDrawnSectionHeaderCount still increments exactly where the caption is drawn -- SidebarSectionHeaderStep pins it at 2 with compact off and 0 with compact on. --- HellionChat/Ui/Components/Sidebar.cs | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/HellionChat/Ui/Components/Sidebar.cs b/HellionChat/Ui/Components/Sidebar.cs index 0886e1d..e52ec21 100644 --- a/HellionChat/Ui/Components/Sidebar.cs +++ b/HellionChat/Ui/Components/Sidebar.cs @@ -6,6 +6,7 @@ using HellionChat.Code; using HellionChat.Resources; using HellionChat.Themes; using HellionChat.Ui.StyleEngine; +using HellionChat.Ui.StyleEngine.Widgets; using HellionChat.Util; using Microsoft.Extensions.Logging; @@ -66,6 +67,7 @@ internal sealed class Sidebar private readonly ThemeRegistry _themes; private readonly TokenResolver _resolver; + private readonly WidgetPalette _palette; private readonly FontManager _fonts; private readonly ILogger _logger; private readonly Windows.ChannelPopoutPool _pool; @@ -80,6 +82,7 @@ internal sealed class Sidebar { _themes = themes; _resolver = resolver; + _palette = new WidgetPalette(resolver); _fonts = fonts; _logger = logger; _pool = pool; @@ -181,18 +184,23 @@ internal sealed class Sidebar } } - // Section transition marker (1.5.6 parity): the separator always renders, - // compact mode suppresses only the header text. Real cursor-advancing - // widgets on purpose — rows advance the cursor via InvisibleButton, so a - // drawlist-only header would overlap the next row. + // Section transition marker (1.5.6 parity): the rule always renders, compact + // mode suppresses only the caption. LineDivider submits its own layout item + // and carries its own padding, which is what lets the rows below sit flush + // without the header collapsing onto them. private void DrawSectionHeader(string header, int count) { - ImGui.Separator(); - if (Plugin.Config.AutoTellTabsCompactDisplay) - return; + var colors = _themes.Active.Colors; + var compact = Plugin.Config.AutoTellTabsCompactDisplay; - ImGui.TextDisabled($"{header} ({count})"); - LastDrawnSectionHeaderCount++; + LineDivider.Draw( + compact ? null : $"{header} ({count})", + _palette.Abgr(Token.Border, colors), + _palette.Abgr(Token.TextMuted, colors) + ); + + if (!compact) + LastDrawnSectionHeaderCount++; } private void DrawRow(