fix(chat): route inventory item-link addIfNotPresent into InputBar
The AddonChatLog.OnRefresh hook is registered and fires correctly when the user picks "Link item" from the inventory right-click menu in-game. The detour extracts addIfNotPresent="<item>" from the AtkValue array — verified empirically via a temporary _logger.LogDebug diagnostic build (eventId=31 valueUInt=C addIfNotPresent=<item>). Pre-fix the extracted value was discarded with `_ = addIfNotPresent;` and a comment "Chat-window Activated integration is offline until the new chat layer surfaces an Activated entry point." The Activated entry point on the new v1.7.0 component layer has existed since that cycle (InputBar.AppendPending + InputBar.Activate, same pattern as PayloadHandler.DrawStatusPopup:546-549), but the rewiring was forgotten when ChatLogWindow.Activated() was removed. Route addIfNotPresent through InputBar.AppendPending with a v1.5.6-equivalent !PendingMessage.Contains() guard to prevent double-insertion on repeated OnRefresh events. Activate = true marks the input bar for ImGui.SetKeyboardFocusHere on the next draw, so the user can immediately keep typing after the link is inserted. Verified in-game: right-click "Link item" on multiple inventory items inserts <item> into the HellionChat input bar, repeated link insertion does not produce <item><item>, MainWindow gains keyboard focus.
This commit is contained in:
@@ -248,9 +248,13 @@ internal sealed unsafe class Chat : IDisposable
|
||||
addIfNotPresent = add;
|
||||
}
|
||||
|
||||
// Chat-window Activated integration is offline until the new chat
|
||||
// layer surfaces an Activated entry point.
|
||||
_ = addIfNotPresent;
|
||||
// Route the addIfNotPresent token into the InputBar so inventory
|
||||
// right-click "Link item" reaches our input field instead of being lost.
|
||||
if (addIfNotPresent != null && !Plugin.InputBar.PendingMessage.Contains(addIfNotPresent))
|
||||
{
|
||||
Plugin.InputBar.AppendPending(addIfNotPresent);
|
||||
Plugin.InputBar.Activate = true;
|
||||
}
|
||||
|
||||
return 1; // Prevent vanilla chat log from gaining focus
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user