fix(tell): couple CurrentTab to the active tab, retire LastTab

Plugin.CurrentTab now delegates to MainWindow.ActiveTab (fallback Tabs[0]) instead of the never-assigned LastTab index, so the game hooks, unread tracking, notification sounds, InputDisabled and Foray/Eureka paths all operate on the tab the user actually has selected. The dead LastTab/WantedTab fields and both WantedTab writes are removed.

A reference-based MainWindow.ResetActiveTabIfRemoved repairs the active-tab reference on eviction/logout (immune to the SaveConfig temp-tab strip window). The worker-thread eviction path marshals it onto the framework thread so the strip mutation serializes with Draw; logout is already framework-thread. The Draw-seed gains a lazy re-seed for a wholesale config swap. Adds CurrentTabCouplingStep (headless) and the interactive CurrentTabGuidedStep self-test (step count 30 -> 32).
This commit is contained in:
2026-06-13 16:09:59 +02:00
parent ad635c77c1
commit 0ca8513065
5 changed files with 314 additions and 26 deletions
+8 -11
View File
@@ -182,17 +182,12 @@ public sealed class Plugin : IAsyncDalamudPlugin
internal DateTime GameStarted { get; }
// Tab management lives here rather than in ChatLogWindow for access reasons.
internal int LastTab { get; set; }
internal int? WantedTab { get; set; }
internal Tab CurrentTab
{
get
{
var i = LastTab;
return i > -1 && i < Config.Tabs.Count ? Config.Tabs[i] : new Tab();
}
}
// Couples "current tab" to the real UI selection. The chat hooks are
// installed before MainWindow is Phase-1 resolved, so the null-conditional
// fallback to Tabs[0] is load-bearing — it keeps the pre-coupling behavior
// in that early window rather than being merely defensive.
internal Tab CurrentTab =>
MainWindow?.ActiveTab ?? (Config.Tabs.Count > 0 ? Config.Tabs[0] : new Tab());
public Plugin()
{
@@ -406,6 +401,8 @@ public sealed class Plugin : IAsyncDalamudPlugin
new SelfTests.SidebarSectionHeaderStep(this),
new SelfTests.ScrollSnapDecisionStep(this),
new SelfTests.TellResetOnActivateStep(),
new SelfTests.CurrentTabCouplingStep(this),
new SelfTests.CurrentTabGuidedStep(this),
]);
// Re-surface the wizard for existing users when a major UX