Repository navigation
Fix find field arrow keys - #4804
lawrencecchen wants to merge 3 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
1 similar comment
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
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:
📝 WalkthroughWalkthroughAdds a predicate to gate arrow-key dispatch for focused Find text fields, a recursion guard and forwarding in window-level key handling, explicit moveUp/moveDown handlers in find overlays, and UI tests plus helpers for focused-arrow editing and caret/navigation behavior. ChangesFind Text Field Arrow-Key Navigation
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related issues
Caution Pre-merge checks failedPlease resolve all errors before merging. Addressing warnings is optional.
❌ Failed checks (1 error, 1 warning)
✅ Passed checks (15 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 |
Greptile SummaryThis PR fixes arrow-key routing and caret/selection preservation for the terminal and browser find bars. It routes allowed arrow keyDown events directly to the focused find field editor (preventing AppKit menu interception), maps Up/Down to previous/next match navigation, and tightens selection bookkeeping so stored find selections survive Cmd+Option pane switches and repeated Cmd+F without being clobbered by AppKit's spurious
Confidence Score: 5/5Safe to merge — changes are localized to find-field key routing and selection bookkeeping, follow established patterns, and are covered by new XCUITests that include a regression proof commit. All production changes follow the existing depth-counter and selection-tracking patterns in the codebase. The FindTextFieldSupport.swift — the Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[NSWindow receives keyDown event] --> B{First responder\nis find text field?}
B -- No --> C[Existing routing:\nbrowser omnibar / cmd palette / text box]
B -- Yes --> D{Arrow key 123-126\nwith allowed modifiers?\nNo marked text?}
D -- No --> C
D -- Yes --> E{cmuxFindTextFieldArrowForwardingDepth > 0?}
E -- Yes: re-entrant --> F[Return false — bubble normally]
E -- No --> G[depth += 1\nfirstResponder?.keyDown with event\ndepth -= 1\nReturn true — consumed]
G --> H{NSTextView delegate\ntextView:doCommandBy:}
H -- moveDown --> I[rememberSelection\nonReturn false = next match]
H -- moveUp --> J[rememberSelection\nonReturn true = prev match]
H -- Left/Right/Cmd+Left/etc --> K[Text field handles\ncaret / selection editing]
K --> L[cmuxDidObserveSelectionChange fires\nGuard: skip if selection == 0,0\nAND cmuxFocusTransitionRememberedSelection != nil AND != 0,0]
L --> M[cmuxRememberSelection stored]
Reviews (15): Last reviewed commit: "test: cover find field selection edge ra..." | Re-trigger Greptile |
a71a85b to
a4439a7
Compare
a4439a7 to
7a68041
Compare
d28ca2c to
07547ef
Compare
22aef18 to
4e15c73
Compare
4e15c73 to
e94c28c
Compare
e94c28c to
38437e9
Compare
d5f5af2 to
604907b
Compare
604907b to
9d28b92
Compare
Summary
{2, 0}survives Cmd+Option pane navigation away and back, then inserts at the restored cursor position.Regression proof
54be61d9885828f114ab6dd9cd2753d5951908ae: https://github.com/manaflow-ai/cmux/actions/runs/26503247523, artifact https://github.com/manaflow-ai/cmux-dev-artifacts/issues/1834. It fails because the caret is{4, 0}instead of{2, 0}after Left, Left in Cmd-F before Cmd+Option navigation.38437e9aa2bc407f7cd57f90284f669f607894af: https://github.com/manaflow-ai/cmux/actions/runs/26503583583, artifact https://github.com/manaflow-ai/cmux-dev-artifacts/issues/1836. It passesFindSelectionShortcutUITests/testFindCaretPositionSurvivesCmdOptionPaneNavigation.Verification
git diff --check./scripts/lint-pbxproj-test-wiring.sh./scripts/reload.sh --tag findarrNote
Medium Risk
Touches global key routing and find focus/selection state across terminal and browser; behavior is heavily covered by new UI tests but still affects a sensitive input path.
Overview
Fixes terminal and browser find fields so arrow keys edit the query and navigate matches instead of being swallowed by global shortcut routing.
Keyboard routing: Adds
shouldDispatchFindTextFieldArrowViaFirstResponderKeyDownand forwards allowed arrow keyDown events to the find field editor inAppDelegate(with reentry guard), matching omnibar/command-palette behavior.Find overlays: Terminal and browser search delegates map Up/Down to previous/next match (like Return/Shift+Return). Focus logic prefers stored selection when refocusing.
Selection persistence:
FindTextFieldSupportandcmuxApplyFindFocusSelectionkeep caret/selection across pane switches (Cmd+Option), repeated Cmd+F, and focus transitions—ignoring transient{0,0}resets during editing.Tests: Expands
FindSelectionShortcutUITestsfor in-field arrow editing, caret/edge ranges after pane navigation, browser Up/Down match navigation, and more stable launch handling.Reviewed by Cursor Bugbot for commit 9d28b92. Bugbot is set up for automated code reviews on this repo. Configure here.