fix(tmux): use actual pane dimensions and configured min width for grid calculation

Agent area width now uses real mainPane.width instead of hardcoded 50%
ratio. Grid planning, split availability, and spawn target finding now
respect user's agent_pane_min_width config instead of hardcoded
MIN_PANE_WIDTH=52, enabling 2-column grid layouts on narrower terminals.
This commit is contained in:
YeonGyu-Kim
2026-02-17 04:10:27 +09:00
parent 219c1f8225
commit b3c5f4caf5
5 changed files with 112 additions and 10 deletions
@@ -1,5 +1,4 @@
import type { SplitDirection, TmuxPaneInfo, WindowState } from "./types"
import { MAIN_PANE_RATIO } from "./tmux-grid-constants"
import { computeGridPlan, mapPaneToSlot } from "./grid-planning"
import { canSplitPane, getBestSplitDirection } from "./pane-split-availability"
import { MIN_PANE_WIDTH } from "./types"
@@ -52,8 +51,14 @@ function findSplittableTarget(
return null
}
const plan = computeGridPlan(state.windowWidth, state.windowHeight, existingCount + 1)
const mainPaneWidth = Math.floor(state.windowWidth * MAIN_PANE_RATIO)
const plan = computeGridPlan(
state.windowWidth,
state.windowHeight,
existingCount + 1,
state.mainPane.width,
minPaneWidth,
)
const mainPaneWidth = state.mainPane.width
const occupancy = buildOccupancy(state.agentPanes, plan, mainPaneWidth)
const targetSlot = findFirstEmptySlot(occupancy, plan)