Skip to content

Add 2-pane editing (experimental)

Mike Boyer requested to merge multi-pane-editing into main

Two independent Pane objects (paneA/paneB), each owning its own tabs/ active-index/DOM refs (ids suffixed -a/-b, shared styling moved from id-selectors to classes). Confirmed while planning this: it's a frontend-only change -- every backend endpoint already takes an explicit path/text per request, so no pyide_web.py Python changes were needed.

The toolbar stays a single shared row, not duplicated per pane -- every handler takes an explicit pane argument resolved at the moment of the click/keypress rather than read from inside the function, so an in-flight async save/lint/debug call can't get redirected if focus moves to the other pane while it's still in flight. Shared single-instance widgets (Problems panel, Preview button) guard on pane===focusedPane via syncSharedToolbar()/onPaneFocus() so a background pane's state can't clobber what's currently displayed.

Split: on/off is a two-state toggle (off by default, persisted like Syntax) -- same "don't cost people who don't want it" reasoning given the T42p target. Ctrl+Click go-to-definition jumps into the other pane when Split is on, same pane when it's off; tested end-to-end against the real click handler by adding a _mockQueue to the test harness's XHR stub (purely additive -- existing scenarios untouched). Debug stays a single global session (backend unchanged) but a new debugPane (frontend-only) tracks which pane started it, so browsing files in the other, uninvolved pane can't kill an unrelated debug session.

Known, accepted limitation: the two panes have independent tabs arrays, so the same file can be open in both as separate, unsynced copies -- same model as two separate editor windows. openFile() warns via status(), doesn't block or attempt to sync.

Also fixes two real layout bugs found by hand-testing in a browser (the JS test harness stubs DOM elements and can't run an actual flexbox layout engine, so neither was catchable by test_client_js.js alone):

  • #pane-a had a static width:50% CSS rule with no dependency on Split's state, so it stayed pinned at half width even with pane-b hidden -- the tab bar didn't reach the far edge with Split off. Fixed by moving that width behind a new #edcol.split class that toggleSplit() manages.
  • Once actually fixed with a class-scoped width rule, the pane divider still didn't visibly resize anything: .pane{flex:1} sets flex-basis:0%, and flexbox lets a non-auto flex-basis override plain width for sizing -- the split-mode rule set width but never reset flex-grow/flex-basis, so both panes kept flex-growing equally regardless of what the resizer set. Fixed with flex:0 0 auto, matching how #side (whose resizer already worked) was set up.
  • makeResizer() gained an optional skipInitialRestore flag so its normal unconditional boot-time restore-from-localStorage doesn't reapply a previously-dragged pane width while Split defaults to off; restorePaneWidth() applies/clears it only when Split actually toggles on/off.

Also folded in three small UI requests that touched the same toolbar/ HTML section: theme dropdown moved to the far right (#rootlbl's flex:1 already pushes anything after it there); confirmed Reload plugins already picks up new theme .css files with zero code changes (list_themes() already re-scans themes/ on every call); "(root)" in the file-tree breadcrumb and New File prompt now both say "(working dir)".

test_client_js.js: existing scenarios A/B/C/D/E/F/G threaded through explicit pane arguments; new scenarios for the pane-split resizer (I2b), Split toggle + the two layout-bug regressions (S), and cross-pane go-to-definition (K). All seven test files pass.

Branch: multi-pane-editing (explicitly experimental per the user). Not yet exhaustively tested beyond the two bugs found and fixed above -- worth continued hands-on testing with more in-depth code examples.

Co-Authored-By: Claude Sonnet 5 noreply@anthropic.com

Merge request reports