Skip to content

fix(layout): Keep popups inside the editor on small screens and deep stacks - #47

Merged
mhiro2 merged 1 commit into
mainfrom
fix/layout-onscreen-invariants
Aug 27, 2026
Merged

fix(layout): Keep popups inside the editor on small screens and deep stacks#47
mhiro2 merged 1 commit into
mainfrom
fix/layout-onscreen-invariants

Conversation

@mhiro2

@mhiro2 mhiro2 commented Aug 27, 2026

Copy link
Copy Markdown
Owner

Summary

  • Fix popup geometry so a min_size larger than the editor no longer bypasses the screen bound: on a 30-column screen the third stacked popup used to be computed 60 columns wide.
  • Bound the cascade offset and reserve the border cells, so popups stay fully visible at any stack depth instead of drifting off the right and bottom edges.

Changes

  • 590c9f6 : fix(layout): keep popups inside the editor on small screens and deep stacks
    • Make clamp() prefer max on an inverted range, so the editor size always wins over a too-large min_size.
    • Reserve the two border cells when sizing and clamp row/col after the cascade offset, keeping width, height and position on screen for every style and stack depth.
    • Size the zoomed popup to the editor minus its border, which previously placed the right and bottom border off screen.
    • Add layout invariant tests covering deep stacks in all three styles, the too-large min_size case, and the zoomed popup.

…stacks

clamp() returned min when min exceeded max, so a min_size larger than the
editor bypassed the screen bound entirely: on a 30-column screen the third
stacked popup was still computed 60 columns wide. Offsets were also applied
without an upper bound, pushing deep stacks past the right and bottom edges,
and the popup border was never accounted for although every popup is opened
with border = "rounded".

- Make clamp() prefer max when the range is inverted, so the editor size
  always wins over a too-large min_size.
- Reserve the two border cells when sizing and clamp row/col after the
  cascade offset, so width, height and position keep the whole popup on
  screen at any stack depth.
- Size the zoomed popup to the editor minus its border instead of the full
  editor, which used to place the right and bottom border off screen.
@mhiro2 mhiro2 self-assigned this Aug 27, 2026
@mhiro2 mhiro2 added the bug Something isn't working label Aug 27, 2026
@mhiro2
mhiro2 merged commit b697525 into main Aug 27, 2026
3 checks passed
@mhiro2
mhiro2 deleted the fix/layout-onscreen-invariants branch August 27, 2026 13:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant