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.
This commit is contained in:
@@ -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<Sidebar> _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(
|
||||
|
||||
Reference in New Issue
Block a user