Repository navigation
iOS: anchor the keyboard-rise render slide to the cursor row - #9133
Merged
Merged
Conversation
Even with the deferred shrink resize, the keyboard rise still shoved every terminal row up by the keyboard height: the old render is bottom-pinned to the live viewport, and for a prompt sitting in the upper half of the screen the rows the keyboard covers are the BLANK rows below it. Riding the screen bottom pushed the content rows to renderRect y=-287 in the captured repro and the settle resize dropped them back — the "momentary push of all terminal rows". While the negotiation is unsettled and the viewport is not growing, the render now slides only as much as needed to keep the cursor row visible: the blank space below the cursor absorbs the keyboard intrusion first (zero motion for short content), and a full-screen prompt keeps the legacy ride so it never hides under the keyboard. The cursor bottom comes from the same non-blocking ghostty_surface_ime_point read the cursor overlay uses. The anchor also holds at live == target while the deferred resize waits on the grid echo, so the final stretch of the transition cannot snap. Verified on-device-sim with the same scripted dance as the repro: renderRect held at 440x714@0 through the entire rise (previously -45 -> -287) and frame analysis of the recording shows the text top at the same pixel in all 384 frames across raise and dismiss.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughThe change adds cursor-bottom measurement from Ghostty, passes it through viewport render-rectangle computation, and uses it during provisional keyboard-shrink bottom pinning. Tests cover cursor-aware, covered, last-row, unknown-cursor, and steady-state cases. ChangesCursor-anchored viewport rendering
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant GhosttySurfaceView
participant TerminalViewportSnapshot
participant TerminalLetterboxGeometry
GhosttySurfaceView->>GhosttySurfaceView: Read Ghostty IME point
GhosttySurfaceView->>TerminalViewportSnapshot: Pass cursorBottomInRender
TerminalViewportSnapshot->>TerminalLetterboxGeometry: Compute pinned bottom edge
Possibly related PRs
🚥 Pre-merge checks | ✅ 25✅ Passed checks (25 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
Follow-up to #8907 (merged as the hotfix): the "momentary push of all terminal rows" was still reproducible on main when the keyboard OPENS.
Repro on main, captured in the app debug log with a scripted simulator dance: the deferred old render is bottom-pinned to the live viewport during the rise, so with a prompt in the upper half of the screen (blank rows below it) the content slid to
renderRect=440x714@-287for ~0.3s and the settle resize dropped it back. The rows the keyboard covers are blank, so no motion is needed at all.Fix: while the grid negotiation is unsettled and the viewport is not growing,
TerminalLetterboxGeometry.renderPinnedBottomEdgeanchors the slide to the cursor row instead of the screen bottom — the blank space below the cursor absorbs the keyboard intrusion first (zero motion for short content), sliding starts only once the cursor row itself would be covered, and a full-screen prompt keeps the exact legacy ride so it never hides under the keyboard. Unknown cursor falls back to the legacy ride. The anchor also holds atlive == targetwhile the deferred resize waits on the grid echo. The cursor bottom comes from the same non-blockingghostty_surface_ime_pointread the cursor overlay already performs on the main thread.Verification, before vs after on the identical scripted dance (raise + dismiss over a live Mac attach, window recorded at 20fps):
geom.deferShrinkthenrenderRect@-45 → @-287 → settle @0; recording shows all rows jumping up and back.renderRect=440x714@0on every geometry pass through the rise,440x397@0held through the dismissal; frame analysis puts the text top at the same pixel in all 384 frames.CmuxMobileTerminalKithost tests: 111 pass, including new cases for cursor-anchored shrink (no-motion, exact-slide, full-screen fallback, unknown-cursor fallback, settled-shrink unchanged).A red/green two-commit split was not practical: the failing assertion requires the new
cursorBottomInRenderparameter to exist, so a test-only first commit cannot compile without shipping a stub of the fix.No user-facing strings changed; no localization impact.
🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Summary by cubic
Anchors the terminal render during iOS keyboard rise to the cursor row to stop the brief upward slide of all rows when the keyboard opens. Keeps the prompt visible with zero motion for short content; full-screen prompts keep the legacy ride.
ghostty_surface_ime_pointand passcursorBottomInRenderthroughGhosttySurfaceView→TerminalViewportSnapshot→TerminalLetterboxGeometry.CmuxMobileTerminalKitfor no-motion, exact-slide, full-screen fallback, and unknown-cursor cases; all host tests pass.Written for commit d5a860b. Summary will update on new commits.
Summary by CodeRabbit
Bug Fixes
Tests