Fix Find in File search field being unclickable after Enter in Vim mode - #14836
Draft
warp-agent-staging[bot] wants to merge 2 commits into
Draft
Fix Find in File search field being unclickable after Enter in Vim mode#14836warp-agent-staging[bot] wants to merge 2 commits into
warp-agent-staging[bot] wants to merge 2 commits into
Conversation
In Vim mode the code editor's find input is set to `InteractionState::Disabled` when Enter commits the query (and by `*` / `#`), which hands the caret back to the editor and routes subsequent keystrokes to Vim. A disabled editor element ignores mouse events, so the field could only be re-activated with Cmd+F. Wrap the find input in a `Hoverable` that dispatches a new `FindAction::FocusFindInput` on mouse-down. The handler is a no-op while the input is editable, so ordinary click-to-place-caret is unchanged; when the input is disabled it makes the field editable, selects the query, and focuses it, reusing the same activation path as `on_focus`. CHANGELOG-BUG-FIX: Fixed the Find in File search field not being clickable after pressing Enter with Vim mode enabled. Co-Authored-By: Warp Agent <agent@warp.dev>
The previous regression tests invoked `FindAction::FocusFindInput` directly, which bypassed the `Hoverable` wrapper entirely: a mis-sized or unwired wrapper would still have passed, and nothing asserted that the query editor regained focus or that typing was routed to it. Render the code editor and its find bar into a `Presenter`, then dispatch a real `LeftMouseDown`/`LeftMouseUp` pair at the find input's painted bounds. The tests now assert the input is focused and editable afterwards, and the Enter case additionally types through the window and asserts the query changed while the buffer and the Vim mode did not. Give the find input a saved position so its bounds can be resolved for those mouse events, matching the existing `case_sensitive_button` save position in the same view. Co-Authored-By: Warp Agent <agent@warp.dev>
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.
Description
With Vim mode enabled, pressing Enter in the code editor's Find in File field left the field stuck at
InteractionState::Disabled. A disabled editor element ignores mouse events (EditorElement::mouse_downreturns early when!can_select), so the only way to edit the query again was to reopen the bar with Cmd/Ctrl+Shift+F. The same dead-end applied to the field left disabled by Vim's*/#(search_word_at_cursor).The disabled state is load-bearing — it is what routes subsequent keystrokes to Vim instead of the find input (the
VimUserTypedguard incode/editor/view/actions.rs) and what dims the committed query — so this keeps it and instead makes a click re-activate the field.Changes
FindAction::FocusFindInput, dispatched from aHoverablewrapped around the find input inCodeEditorFind::render_find_row. The handler is a no-op while the input is editable, so ordinary click-to-place-caret behaviour in the find field is unchanged.CodeEditorFind::activate_find_input(make editable, select the query, focus) and reused it from both the new action handler andView::on_focus, which previously inlined the same logic.SavePosition(mirroring the existingcase_sensitive_buttonone in the same view) so its bounds can be resolved for mouse events.n/Nstill cycle, and the non-Vim Enter path (advance to next match) and the terminal find bar are not on this code path.Linked Issue
CODE-1943
Testing
Two regression tests in
app/src/code/editor/view/vim_handler_tests.rscover the Vim Enter path and the Vim*path. Both drive the real user path rather than the action handler: they render the code editor and its find bar into aPresenterand dispatch aLeftMouseDown/LeftMouseUppair at the find input's painted bounds, then assert the input is focused and editable. The Enter case additionally dispatchesTypedCharactersthrough the window and asserts the query becameetawhile the buffer and the Vim mode were untouched — had Vim received those keystrokes,awould have switched it to Insert mode.Each test was verified to fail in two ways and pass with the change intact:
FocusFindInputhandler neutralized (the fix itself), andHoverable'son_mouse_downwiring removed, which confirms the click really travels through the new wrapper rather than being simulated.Checks run:
./script/formatcargo clippy -p warp --all-targets --tests -- -D warningsand the same with--features tui(matching the workspace feature unification) — cleancargo nextest run -p warp code::editor::— 116 passedcargo nextest run -p warp find— 120 passedManual verification with the locally built client (
cargo run --bin warp) on Linux, with Vim keybindings enabled, on a file opened in the code editor:/opens Find in File, typinghelloshows3/3and highlights the three matches.etareplaces the query, the counter updates to1/4, and the highlights follow. Enter re-commits, and clicking once more re-activates the field again.Screenshots / Videos
Computer-use video recordings
Find in File flow in Warp code editor: Opening the Find in File popup in Warp's code editor, typing the query "hello", pressing Enter, then clicking back into the find field and editing the query to "helloeta" and pressing Enter again.
Computer-use screenshots (4)
Find in File popup after typing "hello" (before Enter): field shows "hello" with caret, counter reads 3/3, and "hello" is highlighted on lines 2, 3, and 5.
Find popup immediately after pressing Enter: the query "hello" is dimmed/grey with no visible caret (inactive/committed field), counter still 3/3, and the file cursor has moved to line 5.
Find popup after clicking back into the search field: the query "hello" is now selected/highlighted with a blue selection background, indicating the field is active again.
Find popup after typing "eta" (which replaced the selected "hello"): field shows "eta" with caret, counter reads 1/4, and "eta" is highlighted within beta (line 1, active), zeta and standalone eta (line 3), and theta (line 4).
Agent Mode
Conversation: https://staging.warp.dev/conversation/40763365-157a-4144-a562-828a8fa58ee9
Run: https://oz.staging.warp.dev/runs/019fddcd-625c-7bb8-a71e-ad8aa35b1614
This PR was generated with Oz.