Frame owner S4 (switch on): a low prompt's bottom hold keeps its pane's width and never leaves a band
Summary
FRAME OWNER REFACTOR S4, a switch-on fix before the default flip of motion.frameOwner.terminals (review of #35470 at c4d6c936c92, H1). With the switch off (the default) nothing changes.
With the switch on, a pane that a key press grows taller with its prompt in the lower half keeps its terminal at the press's final size on the pane's bottom edge (F2 in #35470), so the prompt stays in view. That hold placed the final size on the hold's first edges, which went wrong when one spring had two presses:
- a 2x2 grid, Ctrl-Shift-H on the bottom-right pane, then Ctrl-Shift-K before the landing: the final width stayed on the hold's trailing edge, so the moving left edge cut off the start of every line;
- Ctrl-Shift-J twice, then Ctrl-Shift-K: the K press's final size was shorter than the pane mid-spring, so a band of the terminal's ground showed above the text until the landing.
TerminalHostView.followedSurfaceFrame now keeps, with the switch on, only that hold's height, and only while it is taller than the pane's area: the bottom stays on the area's bottom edge, with the area's leading edge and width. A single J or K press does not change.
Frames (switch on): terminal, key resize, low prompt, two presses in one spring. Before: the lines are cut on a moving side edge, or a band of ground shows above the terminal. After: in every frame the terminal has its pane's width and leading edge, and covers the pane from top to bottom; the prompt row stays in view.
Testing
Red, then green (fleet steps, package-test-lane.sh suite):
- Red at
5d22dbc42a0(the two tests on feat), stepbda107fad1e13435d5c3f963, PaneContentPolicyTests:aLowPromptBottomHoldAfterAPressOnTheOtherAxisKeepsItsPanesWidth("frame 1: p4's surface x -29.0 width 653.0, its area's x 0.0 width 624.0") andaLowPromptBottomHoldNeverLeavesABandAboveTheTerminal("frame 6: p1's surface 411.0 pt tall in a 412.0 pt area"). - Green at
03c050e893f, step7037bdb1fbfed1e4d9dba9b9: PaneContentPolicyTests (19 tests), TabStripFollowsPaneTickTests, KeyResizeFirstTickPinTests, PaneGroundCoversPaneTests, KeyboardResizeContentHoldTests, KeyboardResizeReflowAfterLandingTests and TerminalPaneMotionFinalGridTests all pass.
Review of 03c050e893f (BLOCK, comment 6646601634): with the switch on, a low prompt's bottom hold that is not taller than its area gave the surface the area's frame, but the frame owner still got the hold's .bottom anchor. In a window that draws, a new size shows 1 to 4 refreshes later; until then the kept frame rode the bottom edge, so its top rows were cut and the text moved with the bottom edge (or a band showed above it while the area still grew). Fix 33c589c5388: followedSurfaceFrame returns the frame and its anchor (.bottom only while the hold is taller than the area, else .top), and install, holdSurface, releaseSurfaceHold and layout() place the surface with that one result. Switch off: the same frame as before (place does not read the anchor).
- Red at
5648ea0e221(the new test on03c050e893f), step5978f43d3ff4602016c76607: onlyTerminalSurfaceCommitSizeTests.aKeptFrameOfALowPromptHoldNotTallerThanItsAreaStaysTopLeftfails, at line 162:(surface.frame.minX == host.bounds.minX → true) && (surface.frame.maxY == host.bounds.maxY → false)(the kept frame is not on its area's top-left). The other 6 tests of that suite and the 19 of PaneContentPolicyTests pass. The suite's window draws, so the kept frame is seen. - Green at
33c589c5388: display step32d39ee3aa7dfd82d6b7f5ea: TerminalKeyResizeFrameTests, TerminalFrameOwnerMainThreadTests and TerminalSurfaceCommitSizeTests pass (the new test andaKeptFrameStaysOnTheEdgesItsHoldNamesincluded); step5e53024a7d1dc36317551538: the same 7 pane suites as above pass. The band test now also expects that p1 kept a bottom hold after the K press (the review's item 2), so it cannot pass with nothing tested.
Observed / Not run
- Observed: the steps above;
prepush-gate.pypasses. - Not run: films. pixel-perfect's low-prompt journeys film this path with the switch on in the flip PR's films.
No capture: the change is behind a Debug switch that is off by default.
Changelog
none
![Autofix with [code]smith](https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-dark-3x.png)
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.
Summary by cubic
Fixes two frame-owner bugs in the bottom hold that keeps a low prompt in view, when motion.frameOwner.terminals is on. The held surface now keeps its pane's width and leading edge, and only holds its height while it is taller than the pane, so it never cuts off line starts or shows a band of ground above the terminal. The hold's anchor now comes from the same decision as its frame, so a frame kept while a new size waits stays on the area's top-left instead of riding the bottom edge and cutting its top rows. With the switch off, nothing changes.
Bug Fixes
- After a press on the other axis (H then K on a bottom-right pane), the moving left edge no longer cuts off the start of every line.
- After two grow presses and a shrink (J, J, K), the terminal no longer leaves a band of ground above the text mid-spring.
- A kept frame of a low-prompt hold that is not taller than its area stays on the area's top-left instead of moving with the bottom edge.
- Adds red-green regression tests covering all three sequences.