From d9a3fa0cb00ababc8d13663e45b5d25c0c01b65b Mon Sep 17 00:00:00 2001 From: Jinwoo-H Date: Sun, 20 Sep 2026 23:39:44 -0400 Subject: [PATCH] docs(terminal): record why the leaf walk counts an empty binding The ownership walk refuses one; the two rules look like an oversight without the reason they differ. --- src/renderer/src/lib/terminal-reveal-tab-adoption.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/renderer/src/lib/terminal-reveal-tab-adoption.ts b/src/renderer/src/lib/terminal-reveal-tab-adoption.ts index c626c3da28b..840f65e981f 100644 --- a/src/renderer/src/lib/terminal-reveal-tab-adoption.ts +++ b/src/renderer/src/lib/terminal-reveal-tab-adoption.ts @@ -23,6 +23,8 @@ export function findTerminalTabIdBindingLeafId( let unboundCarrierTabId: string | null = null for (const [tabId, layout] of Object.entries(state.terminalLayoutsByTabId)) { const carriesLeaf = layout.root ? collectLeafIdsInOrder(layout.root).includes(leafId) : null + // Why `!== undefined` and not truthiness, unlike the ownership walk: an empty binding still + // proves this tab holds the leaf id, and holding it is what forbids re-minting it elsewhere. if (layout.ptyIdsByLeafId?.[leafId] !== undefined && carriesLeaf !== false) { return tabId }