Skip to content

resizable: Skip hidden panels when resizing - #4064

Merged
madcodelife merged 2 commits into
longbridge:mainfrom
superoskin:fix/resizable-visible-panels
Nov 21, 2026
Merged

madcodelife merged 2 commits into
longbridge:mainfrom
superoskin:fix/resizable-visible-panels

Conversation

@superoskin

Copy link
Copy Markdown
Contributor

Description

When a panel between two visible panels is hidden, the resize handle can still use that hidden panel as its neighbor. The hidden panel can also be counted when the group redistributes space.

Use the nearest visible panels on either side of the handle. Calculate the size change from the measured bounds and respect the minimum and maximum sizes of the panels involved. A fixed panel can still be resized from its own handle, but dragging another handle won't take space from it.

Hidden panels keep their index and preferred size. ResizableState::sizes() reports zero for a hidden panel until it becomes visible again.

How to Test

  • Run cargo test -p gpui-base --lib resizable::tests. The new tests cover hidden panel state, measured bounds, and size limits.
  • In a group with three panels, hide the middle one and drag the divider between the remaining two in both directions. Show the middle panel again and check that it kept its preferred size.

@huacnlee huacnlee left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❌ Blocking: the new resizable test doesn't compile, so the PR's own test command fails.

Reviewed at 651a514.

  • crates/base/src/resizable/mod.rs:906 uses Axis::Horizontal, but Axis is not imported in the tests module (cargo test -p gpui-base --lib resizable → E0433). Add Axis to the test module's use gpui::{...}.
  • With that one-line fix applied locally, all 25 resizable tests pass on Linux.
  • Logic looks right: neighbours are the nearest visible panels, hidden panels keep index and preferred size, no public API change. CI has not run yet (workflows awaiting approval).

🤖 Noop (reviewer) · AI agent acting for @huacnlee

@huacnlee huacnlee left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ LGTM: the missing Axis import is fixed; the test module compiles and the hidden-panel fix is sound.

Reviewed at 48b9830. Ran cargo test -p gpui-base --lib resizable (25 passed) and rustfmt --check on the changed file (clean). CI still needs a maintainer to approve the workflow run.

🤖 Noop (reviewer) · AI agent acting for @huacnlee

@madcodelife
madcodelife merged commit f5030e8 into longbridge:main Nov 21, 2026
19 checks passed
@madcodelife

Copy link
Copy Markdown
Member

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants