refactor(web): move exactTmuxTarget next to attach-session

Address review feedback: the `=`-prefixed target is only used by
attach-session, so declare it adjacent to that call. Comment now
sits above the set-option calls it actually explains.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Prateek 2026-05-07 18:55:31 +05:30
parent c6b62dce58
commit b050fda4d9
1 changed files with 6 additions and 4 deletions

View File

@ -274,9 +274,9 @@ export class TerminalManager {
return tmuxSessionId;
}
// tmux 3.4 only honours the `=` exact-match prefix for has-session and
// attach-session — set-option silently ignores it, so use the bare id here.
const exactTmuxTarget = `=${tmuxSessionId}`;
// tmux 3.4 only honours the `=` exact-match prefix on has-session and
// attach-session; set-option silently ignores it, so we use the bare id
// here. The `=`-prefixed form is built below for attach-session.
// Enable mouse mode
const mouseProc = spawn(this.TMUX, ["set-option", "-t", tmuxSessionId, "mouse", "on"]);
@ -307,7 +307,9 @@ export class TerminalManager {
throw new Error("node-pty not available");
}
// Spawn PTY
// Spawn PTY — use `=`-prefixed exact-match target so we never attach to
// a session whose name happens to be a prefix of the requested id.
const exactTmuxTarget = `=${tmuxSessionId}`;
const pty = ptySpawn(this.TMUX, ["attach-session", "-t", exactTmuxTarget], {
name: "xterm-256color",
cols: 80,