Repository navigation
Keep pane-zoom state in sync with the visible layout - #18454
Conversation
PaneManager tracks pane zoom in maximizedWindow_/maximizedTab_, but only restoreLayout() ever cleared them. Several routes changed the visible layout without going through it, leaving the bookkeeping live while the layout looked normal -- and while it is live, the WindowEnsureVisibleEvent handler re-zooms whichever pane raises itself next (a new plot, a package refresh, a render), collapsing the four-pane layout over and over. Three routes are fixed: - The pane header's maximize button reads as "restore" while the pane is EXCLUSIVE, but drove DualWindowLayoutPanel directly, so the vertical split returned while the collapsed columns and the bookkeeping did not. It now ends the zoom through restoreLayout(). - Showing or hiding the sidebar redistributes every column width, undrawing the zoom; it now ends the zoom first. - A persisted zoom was replayed 200ms after startup even though MainSplitPanel deliberately discards zoomed column widths (#16688), a guaranteed desync. Startup now undoes the persisted zoom instead, including the quadrant state DualWindowLayoutPanel restores separately. WindowFrame.maximize() becomes public so PaneManager can override the maximize click handler and still delegate to the default action. Addresses #18444
Intercepting the maximize button alone left two gestures bypassing the zoom bookkeeping: double-clicking the Console title bar (PrimaryWindowFrame) and double-clicking a tabset's tab bar (ModuleTabLayoutPanel) both fired MAXIMIZE straight at the WindowFrame, restoring the quadrant while leaving maximizedWindow_ and the collapsed columns stale. All three gestures now go through WindowFrame.maximize(), which consults a single overridable action, so PaneManager intercepts the gesture in one place instead of per route. setMaximizeClickHandler is replaced by setMaximizeAction for the same reason -- it only covered the button. Addresses #18444
Correctness: - The sidebar can be the pane-zoomed window (Zoom Chat goes through zoomTab -> fullyMaximizeWindow) and zoomColumn's un-zoom branch does not clear the pane-zoom bookkeeping, so escaping that zoom via the sidebar's own button left exactly the stale state this fixes. Funnelling the maximize gestures together also routed a sidebar tab double-click into the same path. The sidebar now gets the same zoom-aware dispatch as the other tabsets. - A source window holding no documents is HIDE, the same quadrant state a zoom gives the zoomed pane's sibling, so the startup undo revealed an empty Source pane. Extracted that doc-count rule out of initPanes as syncSourceWindowVisibility and re-assert it after normalizing quadrants. - getWindowForTab dereferenced a null tab panel: Tab.SourceColumn names a quadrant, never a tabset member, yet it is persistable via fullyMaximizeWindow. It now returns null instead, the startup undo normalizes every pane when the tab does not resolve rather than leaving a sibling hidden, and the failure logs a warning naming the tab. Comments: WindowFrame.maximize() no longer claims to be every route to WindowState.MAXIMIZE (MinimizedWindowFrame and EnsureHeightEvent bypass the frame); showSidebar and the test comments describe present behavior instead of the pre-fix bug; MainSplitPanel.isZoomedColumnState notes what depends on it. Tests: the pane-raising test now waits for Plots to actually be selected -- the session enqueues the console-prompt event before running change detection, so it was measuring widths before the raise could happen. Added coverage for the non-zoomed maximize path through the new indirection, for escaping a sidebar pane zoom, and for hiding the sidebar while zoomed; assert every column after a sidebar toggle; and repair a stuck hidden Source quadrant in afterEach so a failure cannot poison later tests. Addresses #18444
Escaping a sidebar pane zoom through the sidebar frame's own button was fixed, but View > Panes > Zoom Sidebar (and its shortcut) calls zoomColumn directly and bypasses the frame entirely. zoomColumn's un-zoom branch restores the saved widths without clearing maximizedWindow_ / maximizedTab_, so a Chat zoom escaped that way left the same stale state. That branch now delegates to restoreLayout() when a pane zoom is tracked, which restores the same saved widths and clears the bookkeeping with them. Guarded on a recorded pre-zoom width so it can't reach resizeHorizontally with -1; without one the existing fall-through to restoreColumnLayout already clears the state. Addresses #18444
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
|
Manual verification on macOS Desktop, covering the paths the automated tests can't reach. Console title-bar double-click ( Animated paths -- work correctly. The e2e suite always runs with Still not covered, by automation or by hand: a genuine session restart as opposed to a UI Manual testing also confirmed a route this PR deliberately does not cover -- switching from |
RStudio E2E - all platforms1 test(s) failed
View / download the full reportView report online -- opens in the browser, no download needed. Available for 14 days. Download playwright-report.zip -- extract and open
All platforms - commit |
The post-reload half of the resurrect test asserted a must-not-happen condition with expect.poll, which returns on its first passing sample. The un-zoomed layout it checks for is also the layout that exists before the replay would land, so the assertion's ability to catch a replay rested entirely on the preceding fixed 300ms sleep having already carried past it. window.rstudio.ready is not the anchor that sleep needs either: on this re-join path Application.java sets it in initializeAgent(), immediately before initializeWorkbench(), so it can be observed before PaneManager is constructed -- the 300ms is racing workbench construction plus onInit's own 200ms timer, not just the timer. Sample the assertions continuously across a 2s window instead, failing on the first violation, so the layout has to stay un-zoomed rather than merely be un-zoomed once. Also assert the set_client_state gate actually succeeded. waitForResponse resolves on a rejected response too, and a rejected RPC still returns HTTP 200 with an error member, so an unstored zoom would have left nothing for the reload to replay and passed everything below vacuously. Verified by simulating the regression (restoring the pre-fix replay in ZoomedTabStateValue.onInit): the test fails on the intended assertion with TabSet1 at width 0. The old form failed there too on this machine, so this removes a timing dependence rather than a silent pass. Full tests/panes/layout/ suite: 53 passed.
Comments only. The previous wording said window.rstudio.ready can be observed before PaneManager is constructed. It cannot: Application.java calls initializeAgent() and initializeWorkbench() in one task, and WorkbenchScreen builds PaneManager synchronously (paneManager_ = pPaneManager.get()), so the event loop never yields in between and an out-of-page observer cannot see the gap. What ready genuinely does not cover is startup work deferred to a later task, which is what this assertion guards: ZoomedTabStateValue.onInit's 200ms Timer. The hold-for-a-window assertion is unchanged and still correct -- only the reason given for it was wrong.
expectHoldsFor set its deadline on entry, so a slow first sample could consume the whole budget and return having checked the state once -- the single-sample weakness the helper exists to avoid. The first sample can block for a while: it is a locator read, and the element may not have attached yet. Measure the window from the end of that first sample instead. The window can only grow as a result, so the regression check behind the previous commit (pre-fix replay restored in ZoomedTabStateValue.onInit, assertion fails with TabSet1 at width 0) still holds.
Comments only, no code changes. Shorter sentences, one fact each, fewer nested asides. The comments had accumulated long parenthetical chains that were hard to read. Two also carried claims that later review disproved, so they are corrected here rather than left to contradict the skill doc: - The console-prompt comment said executeInConsole resolves before the plots event is queued. Queueing the prompt wakes the event poller before onDetectChanges runs, so whether the poller drains first is a thread race. The event may be unqueued, undelivered, or merely unrendered, and the guidance holds in all three cases. - The ready-flag comment said observing ready proves the panes were built. initializeWorkbench() can return early with a ReloadEvent on a cookie or pref mismatch, before it builds the workbench, so it proves no such thing.
"Any route that does not leaves ..." is correct -- "does not" stands in for "does not end a zoom the same way" -- but the elided verb puts "not" next to "leaves" and a reader has to backtrack. Say "does not do so" instead.
Comments only. The previous pass reflowed these into shorter sentences but kept every word of the content, so they were still far longer than they needed to be. This one deletes instead: 53 lines out of 28 blocks. What went: product mechanism a reader can get from the code (call chains like bringToFront -> EnsureVisibleEvent spelled out hop by hop), "before this fix" narratives that the PR body already tells, restatements of the test title, and the repetition of "a stale zoom re-zooms the next pane" in each test after the describe-block header states it once. What stayed: why a wait or selector is the one it is, since that is the part a reader cannot recover from the code.
* Resolve e2e daily builds per branch, not via /rstudio/latest The e2e workflows installed the build named by dailies.rstudio.com/rstudio/latest/index.json while running the tests from the checked-out branch. Those are two different branches whenever the alias lags a rollover, and its index.json does lag: after the 2026.08 branch cut the /rstudio/latest/ page served Autumn Hawkbit (2026.09) while /rstudio/latest/index.json still named a Yellow Yarrow (2026.08) build. CI reads the JSON, so the scheduled rotation installed a 2026.08 binary and ran main's tests against it. Every test covering behavior added after the cut failed on every platform, with nothing wrong in either the test or the product -- #18454 and #18470 both landed that way. Resolve the manifest from version/RELEASE instead. The new os-resolve-daily-manifest action turns it into the "flower" path segment the same way docker/jenkins/publish-build.sh does when it writes the manifest, so the reader and the writer stay in step, and a manifest named after its own branch cannot be mis-pointed by an alias. It computes a URL and makes no network request, so it is safe in the jobs that end up using an override URL instead. A missing platform key now fails with the branch and key named, and says a source build is the way to test a branch with no daily. Autumn Hawkbit has no Windows build yet, so the Windows engines take that path until one is published; installing a 2026.08 .exe was never a valid substitute. Addresses #18498 * Trigger PR e2e on resolver and version/RELEASE changes The pull_request paths filter lists every composite action these workflows use, but the new os-resolve-daily-manifest was missing, so a PR touching only the resolver would not run the workflow that exercises it. version/RELEASE joins it for the same reason one step further out: it selects which branch's daily each platform resolves, so a change there changes the binary under test. A flower with no daily yet falls through decide() to a source build, so such a PR proves the transition works instead of leaving it to the next cron rotation. Addresses #18498
Note
The NEWS.md will need to be cleaned up before I merge this (once we've branched for release of 2026.08 and reset the NEWS file back to a clean state).
Fixes #18444.
PaneManagertracks a pane zoom inmaximizedWindow_andmaximizedTab_. OnlyrestoreLayout()cleared them. Several routes changed the visible layout withoutgoing through it, so the bookkeeping stayed live while the layout looked normal.
While it is live, the
WindowEnsureVisibleEventhandler re-zooms the next pane thatraises itself: a new plot, a package-list refresh, a render, a
?helplookup. Thatpane takes over the window and its neighbours disappear. An escape from that zoom
left the state live again, and the next raise repeated it.
View > Panesis a live readout of the tracked state. A check-markedZoom <pane>beside a normal-looking layout is the stale condition.
View > Panes > Show All Panesis the recovery.What changed
One replaceable maximize action. Every frame-level maximize gesture now goes
through
WindowFrame.maximize(), which reads a settable action. Three gestures comehere: the maximize button, a double-click on the Console title bar
(
PrimaryWindowFrame), and a double-click on a tabset's tab bar(
ModuleTabLayoutPanel).PaneManagerinstalls one action per pane. The action endsthe zoom with
restoreLayout()when that pane is the zoomed one, and callsmaximizeDefault()otherwise. This replacessetMaximizeClickHandler, which coveredonly the button.
The javadoc records the two paths that still bypass the frame: the button on
MinimizedWindowFrame, andEnsureHeightEvent.MAXIMIZEDthroughLogicalWindow.onEnsureHeight.Sidebar. The sidebar maximizes by a zoom of its column, not its quadrant. But it
can still be the pane-zoomed window, because Zoom Chat goes through
zoomTabandfullyMaximizeWindow. It gets the same zoom-aware dispatch. The matching menu pathis covered too. The un-zoom branch of
zoomColumncallsrestoreLayout()when apane zoom is tracked, so
View > Panes > Zoom Sidebarand its shortcut restore thewidths and clear the bookkeeping together.
Sidebar visibility. A sidebar show or hide lays out the columns again, which can
undraw a zoom.
showSidebartherefore ends an active zoom when visibility changes.Startup.
MainSplitPaneldiscards zoomed column widths (#16688), so a replay ofa persisted zoom always desynced.
ZoomedTabStateValue.onInitnow undoes thepersisted zoom instead. That includes the quadrant half, which
DualWindowLayoutPanelrestores from its own state. A source window that holds nodocuments is
HIDE, which is also the quadrant state a zoom gives the zoomed pane'ssibling. So the doc-count rule moved out of
initPanesintosyncSourceWindowVisibility, and the undo re-asserts it afterwards. That keeps anempty Source pane hidden.
getWindowForTabnow returns null instead of dereferencing a missing tab panel.Tab.SourceColumnnames a quadrant, not a tabset member, butfullyMaximizeWindowcan still persist it. When the persisted tab does not resolve, the undo normalizes
every pane rather than leave a sibling hidden, and logs a warning that names the tab.
Tests
Nine Playwright tests in
e2e/rstudio/tests/panes/layout/panes.test.ts. They covereach clearing route, the reported consequence, and the non-zoomed maximize path
through the new indirection. Each one failed without its fix and passed with it. The
full
tests/panes/layout/suite is 53 passed on desktop.Two of the waits needed care, because the obvious signal passes before the thing
under test can happen:
prompt. The session queues the prompt event and wakes the event poller before it
runs change detection, so at the prompt the plots event can be unqueued,
undelivered, or not yet rendered.
set_client_stateRPC that carries the zoom. Clientstate reaches the server on a passive 5s timer, so a reload otherwise outruns the
save and there is nothing to replay. Its post-reload assertions then sample across
a window instead of once, because
expect.pollreturns on its first passingsample and the pre-replay layout is the passing layout.
Manual verification
configuration does not render that header:
ConsoleTabPanel.managePanelscallssetFillWidgetwhile any secondary console tab is visible. The gesture is liveonly with the Terminal and jobs tabs closed, which is why it is not automated.
e2e suite runs with
reduced_motion: true, so CI never exercises the 300msrestore. All four Zoom Chat escape routes were checked by hand.
Still not covered either way: a genuine session restart, as opposed to a UI reload,
and a window resize while zoomed.
Follow-up
#18448 collects five pre-existing routes in the same family that this PR leaves
alone. One is a two-click reproduction that hides a whole pane column.