Enforce minimum pane size (180px) on split and gutter drag

Spamming the ⇥/⇣ split buttons (or their Ctrl+Shift+E/O shortcuts)
used to subdivide panes indefinitely, leaving toolbar-only slivers
that were unusable.

- tree.ts: MIN_PANE_PX = 180 constant.
- App.tsx: the `split` orchestration callback now computes the active
  pane's pixel dimensions from its layout slot + the container rect,
  and refuses to split if either child would fall below MIN_PANE_PX.
  Surfaces the refusal via a `notify(...)` toast so the user knows
  why nothing happened.
- Gutter.tsx: pointermove clamps the new ratio so the smaller child
  stays at least MIN_PANE_PX wide/tall. Falls back to the old 0.05
  floor only if the parent is so small that two min-sized panes
  can't both fit (degraded but functional).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
megaproxy 2026-05-22 22:01:41 +01:00
parent a5209e08ae
commit daf0d4e88a
3 changed files with 50 additions and 11 deletions

View file

@ -253,6 +253,12 @@ export function setAllBroadcast(root: TreeNode, on: boolean): TreeNode {
return { ...root, a, b };
}
/** Minimum width/height (px) we allow a pane to shrink to. Just enough for
* the toolbar + a few cols/rows of usable terminal. Used by the split
* handler (to refuse subdividing a pane that's already too small) and by
* the gutter drag (to clamp ratios so neither child drops below this). */
export const MIN_PANE_PX = 180;
// --- flat layout (for absolute-positioned rendering) ------------------------
/** Normalised bounding box: top/left/width/height as fractions [0, 1]. */