Repository navigation
fix(ax): shrink before moving so a resize is never cut short at the screen edge - #17
Merged
Merged
Conversation
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
…; log a failed size read
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
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'sImmediateFrameOrder, made stricter (our own code).AXWindow.write(behind a newFrameWritingprotocol) 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.macos-window-apisskill, CHANGELOG Unreleased.Testing
make lint testpasses locally (149 core, 182 app tests)AXWindowTestsreplays 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'tChecklist
CHANGELOG.mdUnreleased updated (if user-visible)