fix(tmux-subagent): enable 2D grid layout with divider-aware calculations
- Account for tmux pane dividers (1 char) in all size calculations - Reduce MIN_PANE_WIDTH from 53 to 52 to fit 2 columns in standard terminals - Fix enforceMainPaneWidth to use (windowWidth - divider) / 2 - Add virtual mainPane handling for close-spawn eviction loop - Add comprehensive decision-engine tests (23 test cases)
This commit is contained in:
@@ -125,7 +125,6 @@ export async function spawnTmuxPane(
|
||||
"-P",
|
||||
"-F",
|
||||
"#{pane_id}",
|
||||
"-l", String(config.agent_pane_min_width),
|
||||
...(targetPaneId ? ["-t", targetPaneId] : []),
|
||||
opencodeCmd,
|
||||
]
|
||||
@@ -185,14 +184,36 @@ export async function applyLayout(
|
||||
layout: TmuxLayout,
|
||||
mainPaneSize: number
|
||||
): Promise<void> {
|
||||
spawn([tmux, "select-layout", layout], { stdout: "ignore", stderr: "ignore" })
|
||||
const layoutProc = spawn([tmux, "select-layout", layout], { stdout: "ignore", stderr: "ignore" })
|
||||
await layoutProc.exited
|
||||
|
||||
if (layout.startsWith("main-")) {
|
||||
const dimension =
|
||||
layout === "main-horizontal" ? "main-pane-height" : "main-pane-width"
|
||||
spawn([tmux, "set-window-option", dimension, `${mainPaneSize}%`], {
|
||||
const sizeProc = spawn([tmux, "set-window-option", dimension, `${mainPaneSize}%`], {
|
||||
stdout: "ignore",
|
||||
stderr: "ignore",
|
||||
})
|
||||
await sizeProc.exited
|
||||
}
|
||||
}
|
||||
|
||||
export async function enforceMainPaneWidth(
|
||||
mainPaneId: string,
|
||||
windowWidth: number
|
||||
): Promise<void> {
|
||||
const { log } = await import("../logger")
|
||||
const tmux = await getTmuxPath()
|
||||
if (!tmux) return
|
||||
|
||||
const DIVIDER_WIDTH = 1
|
||||
const mainWidth = Math.floor((windowWidth - DIVIDER_WIDTH) / 2)
|
||||
|
||||
const proc = spawn([tmux, "resize-pane", "-t", mainPaneId, "-x", String(mainWidth)], {
|
||||
stdout: "ignore",
|
||||
stderr: "ignore",
|
||||
})
|
||||
await proc.exited
|
||||
|
||||
log("[enforceMainPaneWidth] main pane resized", { mainPaneId, mainWidth, windowWidth })
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user