Skip to content

fix(ax): shrink before moving so a resize is never cut short at the screen edge - #17

Merged
iamAdarshh merged 4 commits into
mainfrom
fix/retry-dropped-resize
Oct 25, 2026
Merged

iamAdarshh merged 4 commits into
mainfrom
fix/retry-dropped-resize

Conversation

@iamAdarshh

Copy link
Copy Markdown
Owner

What & why

Closes #16. On the reporter's MacBook (macOS 27, VS Code), ⌃⌥→ then ⌃⌥↑ left the window half width in the top-left corner instead of the full-width top half. Mullion wrote the target size first, so a right-half window was stretched past the screen edge; the app cut that resize short and then dropped the final one, and Mullion kept the smaller size it read back. It doesn't reproduce on every Mac, so this is fixed from the mechanism, tested against a simulated window.

Milestone / roadmap item

Bug fix on v1.0 (no roadmap item).

Changes

  • Core: FrameWrite.sizeBeforeMove. On one display the window first shrinks to the smaller of its size and the target's in each direction, then moves, then gets the target size. That first size fits at both origins, so no write leaves the screen. Windows from another display, and targets spanning two, keep size → position → size. Idea from Rectangle's ImmediateFrameOrder, made stricter (our own code).
  • App: AXWindow.write (behind a new FrameWriting protocol) uses that size, and asks for the size once more when a resizable window came out smaller than asked. Best effort: failures are logged, never thrown, so a snap that moved still counts. Minimum-size and fixed-size windows never trigger it.
  • The retry is logged at debug level ("Resize cut short at … asking again") so the reporter's logs can confirm it.
  • Docs: ARCHITECTURE §5, TESTING.md, the macos-window-apis skill, CHANGELOG Unreleased.

Testing

  • make lint test passes locally (149 core, 182 app tests)
  • New/changed geometry has parameterised tests in MullionCore: every half/quarter/full transition on every screen fixture keeps each write on screen; cross-display moves on each arrangement; a fractional visible frame; a target spanning two displays
  • AXWindowTests replays the writes against a simulated window that cuts a resize short at the screen edge and then drops the next one: the old order needs the retry, the new one doesn't
  • Manual test rows run (docs/TESTING.md), with setups:
    • Not run. Not reproducible on the maintainer's Mac; the reporter will be asked to confirm with the next build

Checklist

  • Public APIs only (ADR-0003)
  • User-facing strings in the String Catalog (none added)
  • Docs updated (PRD / feature spec / SHORTCUTS.md) if behaviour changed (ARCHITECTURE §5; no user-visible behaviour change beyond the fix)
  • CHANGELOG.md Unreleased updated (if user-visible)

Top Half or Bottom Half right after Right Half could leave a VS Code window
half width in the top-left corner. The first resize is cut short at the
screen edge, the app dropped the final one, and Mullion took the half width
it read back as a minimum size. When the frame read back differs from the
target, set the target once more before re-anchoring.

Fixes #16
Resizing a right-half window to the full width in place stretched it past
the screen edge, where VS Code cut the resize short and then dropped the
final one (#16). FrameWrite.order in Core now picks the order that keeps
the window on screen, as Rectangle does; a window from another display
still gets size, position, size.

The retry moves from ActionDispatcher into AXWindow.write: only a
resizable window that came out smaller than asked is asked once more, so
minimum-size and fixed-size windows cost nothing extra, and a failure
there is logged instead of failing the snap. The write sequence is
tested against a simulated window that reproduces #16.

Refs #16
The "least overflow first" order still let a write stretch a window off
screen (Right Half after Bottom Half resized first and was cut at the
bottom edge; Bottom Half after Right Half moved a full-height window
below the screen). FrameWrite.sizeBeforeMove now shrinks the window to
the smaller of its size and the target's before the move: that size fits
at both origins, so no write overflows. A window from another display,
or a target spanning two, still gets the target size first.

The retry reads and writes only the size. The simulated window now drops
a resize only after one was cut short, so the tests show both the bug
with the old order and the fix with the new one. Core tests cover every
tile transition on every screen fixture. TESTING.md and the
macos-window-apis skill are in sync.

Refs #16
@iamAdarshh
iamAdarshh merged commit e3225cd into main Oct 25, 2026
5 checks passed
@iamAdarshh
iamAdarshh deleted the fix/retry-dropped-resize branch October 25, 2026 11:54
@iamAdarshh iamAdarshh mentioned this pull request Oct 25, 2026
2 tasks done
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.

Top-right and Bottom-right tiling not happening with arrow keys

1 participant