fix(split-pane): throttle the drag, chunk the scrollback, and the rest of Ark0N's second pass

Two majors:
- The divider drag was unthrottled: every mousemove did a full xterm
  reflow on BOTH panes and sent Pane B a {t:'z'} resize frame with no
  unchanged-dimensions skip, fanning out into a `tmux resize-window`
  child plus a SIGWINCH per event — ~50 of each dragging across half a
  wide viewport. SplitTerminalPane.fit() is now split into localFit()
  (reflow only) and fit() (reflow + send); the drag coalesces moves
  into one localFit() per animation frame via requestAnimationFrame,
  and sends the real resize for both panes exactly once, at drag end,
  matching the primary pane's own throttledResize convention.
- Pane B pulled the FULL scrollback unchunked for every session mode,
  writing it in one terminal.write() call. Mirrors the primary pane's
  own mode check (app.js's selectSession): shell sessions get a
  bounded 1MiB ?tail= fetch instead of ?full=1, and the fetched buffer
  is written through a minimal chunked writer (32KB slices, yielding a
  frame between each) instead of one primary-pane chunkedTerminalWrite
  this simpler, independently created/destroyed pane has no equivalent
  of (no session-switch generation counters or live-output gate).

Smaller items from the same review:
- Pane B now follows live appearance changes (applyTerminalSkin,
  applyTerminalFontFamily, applyTerminalFontWeights, setFontSize all
  propagate to it, matching the teammateTerminals pattern) and reads
  the real codeman-font-size/terminalFontFamily/weights/DEFAULT_SCROLLBACK
  settings at construction instead of hardcoding fontSize 14 / scrollback 5000.
- The Pane-B-promotion path now skips selectSession() when
  _closingSessions already owns this delete (the user closing Pane A's
  own tab), matching _onSessionDeleted's own active-session-handoff guard.
- Detaching a session AFTER a split is already open now yields the PTY
  size in _sendResize() too (not just at picker-open time), mirroring
  sendResize's own detachedElsewhere guard.
- .btn-split joins the body.solo-mode hide list, next to .btn-multimonitor.
- The split row was 6px wider than its container (two flex-shrink:0
  50% panes plus a 6px divider): both panes are now flex-shrink 1.
- Pane B's header and the split-picker rows are marked so i18n.js's
  exact-string lookup skips them, matching .session-name elsewhere —
  a session literally named e.g. "Sessions" was translatable on zh-CN.
- The Split button now reflects open/closed state via a `.split-open`
  accent style, aria-pressed, and a title/aria-label that says which
  behaviour the next click gets.
- _splitPane.connect() is no longer an unawaited call with no .catch().
- terminal-split.js's fileoverview pointed at a doc path that was
  renamed away in the previous push; @dependency now credits
  constants.js for CodemanTerminalFont, not terminal-ui.js.
- index.html's Split settings chip no longer reuses data-preview-order
  "12" (already the Ultracode Agents chip's slot in the same "header"
  preview group).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
timkjr
2026-09-20 13:10:32 -05:00
co-authored by Claude Sonnet 5
parent 165cfb52d6
commit 2e3e245cc6
7 changed files with 264 additions and 42 deletions
+35 -2
View File
@@ -2289,6 +2289,32 @@ html[data-tab-orientation='vertical'] .tab-rail .session-tab .tab-name-prefix {
display: none !important;
}
/* While a split is open, the button's own click closes it instead of opening
the picker — the accent fill is what tells the user which of its two
behaviours the next click will get (aria-pressed carries the same state
for assistive tech). */
.btn-icon-header.btn-split.split-open {
background: var(--accent);
color: var(--accent-ink);
}
.btn-icon-header.btn-split.split-open:hover {
background: var(--accent);
color: var(--accent-ink);
}
/* Split-pane hard desktop gate, independent of the showSplitButton setting:
two 240px min-width panes plus the divider need ~486px, the divider has no
touch handlers, and mobile.css only loads up to 1023px so it cannot cover
the 1024-1179px tablet range on its own. Same threshold and reasoning as
HOME_SESSIONS_MIN_WIDTH (home-sessions.js) / SPLIT_PANE_MIN_WIDTH
(constants.js) — keep the three in sync. */
@media (max-width: 1179px) {
.btn-icon-header.btn-split {
display: none !important;
}
}
.btn-icon-header.btn-settings {
width: 30px;
height: 30px;
@@ -2554,6 +2580,7 @@ body.solo-mode .header-system-stats,
body.solo-mode .header-tokens,
body.solo-mode .btn-notifications,
body.solo-mode .btn-multimonitor,
body.solo-mode .btn-split,
body.solo-mode .header-plan-usage,
/* A solo window shows ONE session and has no tab strip to put restored ones in,
so offering to rebuild a list of them there is an offer it cannot show the
@@ -18592,7 +18619,12 @@ html[data-session-list="sidebar"][data-sidebar="collapsed"] .btn-sidebar-toggle
}
.terminal-split-container > .terminal-wrap {
flex: 0 0 auto;
/* flex-shrink 1 (not 0): the divider's own 6px is fixed-width, and Pane A
+Pane B's inline flex-basis (openSplitPane/onMove) always sums to 100%,
so with flex-shrink 0 on both panes the row is 100% + 6px wide and
.main's overflow clips Pane B's right edge by exactly the divider's
width. Shrinking lets the two panes give up that 6px between them. */
flex: 0 1 auto;
min-width: 240px;
overflow: hidden;
}
@@ -18610,7 +18642,8 @@ html[data-session-list="sidebar"][data-sidebar="collapsed"] .btn-sidebar-toggle
}
.terminal-pane-b {
flex: 0 0 auto;
/* flex-shrink 1, matching .terminal-wrap above — see its comment. */
flex: 0 1 auto;
min-width: 240px;
display: flex;
flex-direction: column;