From 2e596fbbddfd40cb90f62e7f23d482a819379656 Mon Sep 17 00:00:00 2001 From: RAIT-09 <51452399+RAIT-09@users.noreply.github.com> Date: Tue, 16 Jun 2026 23:59:06 +0900 Subject: [PATCH] fix(session-manager): update focus highlight when switching chat tabs --- src/plugin.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/plugin.ts b/src/plugin.ts index 9b1851c..16313d5 100644 --- a/src/plugin.ts +++ b/src/plugin.ts @@ -381,6 +381,19 @@ export default class AgentClientPlugin extends Plugin { this._acpClients.clear(); }), ); + + // Keep the focused chat view in sync when the active leaf changes + // (e.g. clicking a chat tab in the tab bar). ChatPanel's DOM + // focus/click listeners only fire on interaction inside the view, so a + // tab-bar switch would otherwise leave the Session Manager highlight on + // the previous view until the user clicks into the new one. + this.registerEvent( + this.app.workspace.on("active-leaf-change", (leaf) => { + if (leaf?.view instanceof ChatView) { + this.setLastActiveChatViewId(leaf.view.viewId); + } + }), + ); } onunload() {