Skip to content

Stale pane-zoom state re-zooms any pane that raises itself, breaking the four-pane layout #18444

Closed

Description

@gtritchie

System details

RStudio Edition : Desktop
RStudio Version : 2026.07.1+147
OS Version      : not specified by reporter
R Version       : not specified by reporter

Reported layout: standard four-pane layout (Source upper left, Environment upper
right, Console lower left, Files lower right), with Posit Assistant assigned to
the left sidebar and the sidebar hidden.

Original report: https://forum.posit.co/t/rstudio-keeps-forgetting-pane-layout/216975

Steps to reproduce the problem

Not yet reproduced from a clean state; the trigger that starts it is still open
(see "What is unconfirmed" below). Once a session is in the bad state, the
reported sequence is reliable:

  1. Do anything that makes a pane raise itself -- update R packages, render a
    Quarto document, run a ?help command.
  2. That pane takes over the entire window: its column expands to the full panel
    width and its sibling quadrant disappears.
  3. Click the pane header's maximize/minimize button. The vertical split in that
    column comes back, but the other column stays collapsed -- e.g. the two
    right-hand panes never return.
  4. Re-opening Tools > Global Options... > Pane Layout shows the correct
    configuration and does not restore the layout.
  5. Toggling the sidebar open and closed sometimes restores four visible columns,
    but leaves quadrants in the wrong maximize/minimize state, and the next
    pane-raising action breaks the layout again.

Describe the problem in detail

PaneManager tracks pane zoom in maximizedWindow_ / maximizedTab_. While
maximizedWindow_ is non-null, any pane that raises itself is forcibly zoomed:

// PaneManager.java:492-517  (WindowEnsureVisibleEvent handler)
if (maximizedWindow_ != null && !maximizedWindow_.equals(window))
{
   ...
   fullyMaximizeWindow(window, lastSelectedTab_);   // steals the zoom
   return;
}

Every ensureVisible() in the IDE reaches this handler by way of
WindowFrame.onEnsureVisible (WindowFrame.java:401-417), so updating packages
raises Packages, ?foo raises Help, rendering raises the Render/console pane,
and so on. fullyMaximizeWindow (PaneManager.java:1318) puts the target pane
in EXCLUSIVE (hiding its sibling quadrant) and animates the other columns to
width 0.

So the visible symptoms all follow from one condition: maximizedWindow_ is
stale
-- the zoom bookkeeping says "zoomed" while the layout looks normal.
Nothing that visually undoes a zoom clears those fields. Only restoreLayout()
-> invalidateSavedLayoutState() (PaneManager.java:1614) does, and that is
reached only from End Zoom ("Show All Panes") or a zoom toggle. Each of these
changes the visible layout while leaving the bookkeeping live:

  • the pane header maximize/minimize button drives DualWindowLayoutPanel's state
    machine directly (vertical only); PaneManager never hears about it. With the
    pane in EXCLUSIVE, the button maps to NORMAL via LogicalWindow.java:114,
    which is why the vertical split returns but the collapsed column does not;
  • toggling the sidebar goes through MainSplitPanel.setSidebarWidget /
    removeSidebarWidget, which reset the other columns to default widths
    (MainSplitPanel.java:415-467);
  • a window resize re-applies widgetPercentages_ captured before the zoom
    (MainSplitPanel.java:622-657);
  • the panes pref handler (PaneManager.java:410-480) rebuilds tab panels and
    never touches zoom state, which is why revisiting Pane Layout does not help.

Why it survives a restart. Both halves of a zoom are project-persistent
client state, restored verbatim with no sanity guard:

  • TabZoom -> <proj>/.Rproj.user/<id>/pcs/workbench-pane.pper, replayed 200 ms
    after startup by calling fullyMaximizeWindow again
    (PaneManager.java:143-167);
  • topwindowstate (EXCLUSIVE / HIDE / MAXIMIZE) ->
    pcs/windowlayoutstate.pper (DualWindowLayoutPanel.java:320-332).

Meanwhile MainSplitPanel deliberately refuses to restore zoomed column
widths
(isZoomedColumnState, added for #16688 --
MainSplitPanel.java:162-170). A session that ends while zoomed therefore
reopens with default column widths but live zoom bookkeeping: a guaranteed
desync, where the layout looks correct until the first pane-raising action.

This is the same fragility that #17832 worked around on the test side ("break
the zoom cascade") by adding PaneManager.endZoomIfActive for
resetForNextTest. The product has no equivalent recovery.

Describe the behavior you expected

Raising a pane (package update, render, help lookup) should activate that pane
within the existing layout and never zoom it. Ending a zoom by any route -- pane
header button, sidebar toggle, window resize, Pane Layout changes -- should leave
the zoom bookkeeping and the visible layout in agreement, and a restart should
not resurrect a zoom whose column widths were intentionally not restored.

Diagnostic / workaround

View > Panes is a live readout of the tracked state
(manageLayoutCommands, PaneManager.java:2761-2767): if a "Zoom " item
is check-marked while the layout looks normal, the stale zoom is present.

  • Workaround: View > Panes > Show All Panes (Ctrl+Shift+0;
    Ctrl+Alt+Shift+0 on Windows desktop) is the only route that clears
    maximizedWindow_ / maximizedTab_.
  • If it returns on every launch: with RStudio closed, delete
    workbench-pane.pper and windowlayoutstate.pper from
    <project>/.Rproj.user/<id>/pcs/ (or ~/.local/share/rstudio/pcs/ outside a
    project).

What is unconfirmed

The cascade above is read off the code and matches the report step for step, but
which event first set maximizedWindow_ in this user's session is not
established. Candidates: an explicit zoom that was escaped with the pane header
button; the startup replay of a persisted TabZoom; or a zoom whose widths were
subsequently overwritten by a window resize. The View > Panes checkmark is the
cheapest way to confirm the state is stale in a live session.

Suggested fix direction

  1. Do not replay TabZoom / EXCLUSIVE quadrant state at startup when the
    column widths were not restored -- make the isZoomedColumnState guard in
    MainSplitPanel and the TabZoom restore in PaneManager agree.
  2. Clear the zoom bookkeeping whenever something else re-lays-out the columns
    (sidebar show/hide, pane-header state changes, pane config changes), rather
    than only in restoreLayout().

Metadata

Metadata

Assignees

Labels

buglayout

Type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions