Repository navigation
Fix key repeat rendering lag - #3986
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughGhosttyNSView.keyDown handling removes forced synchronous TerminalSurface refreshes during key repeat and IME input, annotates DEBUG hooks with ChangesKey Repeat Refresh Removal
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 16 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (16 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
Greptile SummaryRemoves the per-keystroke
Confidence Score: 4/5Safe to merge after adding The production change removing cmuxTests/TerminalAndGhosttyTests.swift — the Important Files Changed
Sequence DiagramsequenceDiagram
participant App as NSEvent (keyDown)
participant GNV as GhosttyNSView
participant IKE as interpretKeyEvents / debugTextInputEventHandler
participant GH as ghostty_surface_key
participant TS as TerminalSurface (renderer)
App->>GNV: keyDown(event)
GNV->>IKE: [DEBUG] debugTextInputEventHandler? or interpretKeyEvents
IKE-->>GNV: accumulatedText / directText
GNV->>GH: ghostty_surface_key (repeat/text)
Note over GNV,TS: forceRefresh REMOVED — redraws driven by Ghostty wakeups
GH-->>TS: Ghostty wakeup → renderer redraws
Reviews (7): Last reviewed commit: "fix: respect text input debug hook resul..." | Re-trigger Greptile |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit b0257cb. Configure here.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@Sources/GhosttyTerminalView.swift`:
- Around line 8429-8434: The debug block currently calls
Self.debugTextInputEventHandler(self, textInputEvent) but ignores its Bool
return, preventing a handler from opting into the normal path; change the logic
so you call interpretKeyEvents([textInputEvent]) only when either
Self.debugTextInputEventHandler is nil or when it returns false — i.e., invoke
the handler, capture its Bool result, and if that result is false fallback to
interpretKeyEvents(_:), keeping the same parameters (textInputEvent) and
preserving the existing DEBUG-only conditional around
debugTextInputEventHandler.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: e18337f9-6d82-44da-8b19-5d3531b18b3b
📒 Files selected for processing (2)
Sources/GhosttyTerminalView.swiftcmuxTests/TerminalAndGhosttyTests.swift
|
Verified the Greptile |

Summary
forceRefreshpath so Ghostty wakeups/renderer own steady-state redraws.Closes #1829
Testing
Note
Medium Risk
Touches the core
GhosttyNSView.keyDowninput pipeline and removes a synchronous refresh trigger, which could affect perceived responsiveness or redraw timing under edge-case text input/IME scenarios.Overview
Fixes key-repeat rendering lag by removing the per-text-input
terminalSurface?.forceRefresh(reason: "keyDown.textInput")path inGhosttyNSView.keyDown, leaving redraws to Ghostty wakeups/renderer (and dropping the associatedrefreshMstiming breakdown).Adds a debug-only hook (
debugTextInputEventHandler) aroundinterpretKeyEventsand marks debug observers as@MainActor, then introduces regression tests asserting both printable-repeat and IME-committed repeat events are forwarded to Ghostty without incrementingforceRefreshcounters; also annotatesGhosttyBackquoteRegressionTestswith@MainActorfor main-thread correctness.Reviewed by Cursor Bugbot for commit 0d98959. Bugbot is set up for automated code reviews on this repo. Configure here.
Summary by cubic
Fixes key repeat rendering lag by removing synchronous surface refresh during text input and letting Ghostty drive redraws. Adds debug-only tests proving printable and IME repeat events reach Ghostty without forced refresh; fixes #1829.
forceRefreshfromGhosttyNSView.keyDown; redraws now rely on Ghostty wakeups. Added a debug text-input hook inkeyDownand now honor its Boolean result to optionally bypass default interpretation.testPrintableKeyRepeatDoesNotForceSurfaceRefreshandtestIMECommittedKeyRepeatDoesNotForceSurfaceRefresh; introduced@MainActordebugGhosttySurfaceKeyEventObserveranddebugTextInputEventHandler, and markedGhosttyBackquoteRegressionTestsas@MainActor.Written for commit 0d98959. Summary will update on new commits. Review in cubic
Summary by CodeRabbit
Tests
Refactor
Bug Fixes