Repository navigation
Snap the Find window to its content while the results pane is hidden - #168
Merged
Merged
Conversation
The Find window autosaves its frame. A frame saved while the results pane was showing is tall, and in a new process with the pane hidden (searching the document) the window kept that height: the pane’s own show and hide path, which resizes the window, never ran, and the layoutIfNeeded call in loadWindow does not shrink a window. The options grid, the only view without a firm height, stretched to fill the gap. The window now snaps to the content’s fitting height when it is created with the pane hidden, and windowWillResize:toSize: holds that height while the pane is hidden so a drag cannot open the same gap. Width still resizes, and the pane’s programmatic resizes are unaffected. Adds the Find test target with a test that restores a tall frame and checks the height; it failed with 966 != 252 before this change.
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.
Summary
Pressing ⌘F in a document could open a very tall Find window with a large empty area between the options and the In: row.
The window autosaves its frame (
frameAutosaveName"Find"). Close or quit while the results pane is showing and the saved frame is tall. In a new process with the pane hidden from the start, that frame is restored, the pane's own show/hide path inOakTransitionViewController(which resizes the window) never runs, and thelayoutIfNeededcall inloadWindowdoes not shrink a window. The layoutV:|[options]-[results]-[status]-[buttons]-|then has to put the slack somewhere, and the options grid, with the lowest vertical hugging priority, stretches. Reproduced in a fresh scratch process on a Mac whose saved frame was 785×998.Change
SnapWindowToContent()sets the content height to the scaled container's intrinsic height (the content's fitting size × scale) when the window is created with the pane hidden, keeping the top edge in place.windowWillResize:toSize:holds the height while the pane is hidden, so a drag cannot reopen the gap. Width still resizes. The pane's programmatic resizes do not pass through this delegate method and are unaffected.Frameworks/Find/tests/t_window_height.mmandtextmate_add_tests(Find)inFrameworks/Find/CMakeLists.txt(the Find framework had no test target). The test restores a tall frame through the argument domain, loads the window with the Document target, and checks the content height equals the compact height and that a taller resize request is held. It failed with966 != 252before the change.Verification
Debug build, fresh process, saved frame still 785×998 on disk:
Before the change the first step gave 998 with the empty grid. Project results survive closing and reopening the window with ⇧⌘F, as before.
The CMakeLists.txt change is the test registration only, which is why the build chain guard needs the label.
Changelog
Find: The Find window no longer opens stretched with an empty area when the results pane is hidden.