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.Resources;
|
||||||
using HellionChat.Themes;
|
using HellionChat.Themes;
|
||||||
using HellionChat.Ui.StyleEngine;
|
using HellionChat.Ui.StyleEngine;
|
||||||
|
using HellionChat.Ui.StyleEngine.Widgets;
|
||||||
using HellionChat.Util;
|
using HellionChat.Util;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
@@ -66,6 +67,7 @@ internal sealed class Sidebar
|
|||||||
|
|
||||||
private readonly ThemeRegistry _themes;
|
private readonly ThemeRegistry _themes;
|
||||||
private readonly TokenResolver _resolver;
|
private readonly TokenResolver _resolver;
|
||||||
|
private readonly WidgetPalette _palette;
|
||||||
private readonly FontManager _fonts;
|
private readonly FontManager _fonts;
|
||||||
private readonly ILogger<Sidebar> _logger;
|
private readonly ILogger<Sidebar> _logger;
|
||||||
private readonly Windows.ChannelPopoutPool _pool;
|
private readonly Windows.ChannelPopoutPool _pool;
|
||||||
@@ -80,6 +82,7 @@ internal sealed class Sidebar
|
|||||||
{
|
{
|
||||||
_themes = themes;
|
_themes = themes;
|
||||||
_resolver = resolver;
|
_resolver = resolver;
|
||||||
|
_palette = new WidgetPalette(resolver);
|
||||||
_fonts = fonts;
|
_fonts = fonts;
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_pool = pool;
|
_pool = pool;
|
||||||
@@ -181,18 +184,23 @@ internal sealed class Sidebar
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Section transition marker (1.5.6 parity): the separator always renders,
|
// Section transition marker (1.5.6 parity): the rule always renders, compact
|
||||||
// compact mode suppresses only the header text. Real cursor-advancing
|
// mode suppresses only the caption. LineDivider submits its own layout item
|
||||||
// widgets on purpose — rows advance the cursor via InvisibleButton, so a
|
// and carries its own padding, which is what lets the rows below sit flush
|
||||||
// drawlist-only header would overlap the next row.
|
// without the header collapsing onto them.
|
||||||
private void DrawSectionHeader(string header, int count)
|
private void DrawSectionHeader(string header, int count)
|
||||||
{
|
{
|
||||||
ImGui.Separator();
|
var colors = _themes.Active.Colors;
|
||||||
if (Plugin.Config.AutoTellTabsCompactDisplay)
|
var compact = Plugin.Config.AutoTellTabsCompactDisplay;
|
||||||
return;
|
|
||||||
|
|
||||||
ImGui.TextDisabled($"{header} ({count})");
|
LineDivider.Draw(
|
||||||
LastDrawnSectionHeaderCount++;
|
compact ? null : $"{header} ({count})",
|
||||||
|
_palette.Abgr(Token.Border, colors),
|
||||||
|
_palette.Abgr(Token.TextMuted, colors)
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!compact)
|
||||||
|
LastDrawnSectionHeaderCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DrawRow(
|
private void DrawRow(
|
||||||
|
|||||||
Reference in New Issue
Block a user