Skip to content

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
masterfrom
fix/code-1943-find-in-file-refocus
Draft

Fix Find in File search field being unclickable after Enter in Vim mode#14836
warp-agent-staging[bot] wants to merge 2 commits into
masterfrom
fix/code-1943-find-in-file-refocus

Conversation

@warp-agent-staging

@warp-agent-staging warp-agent-staging Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

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_down returns 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 VimUserTyped guard in code/editor/view/actions.rs) and what dims the committed query — so this keeps it and instead makes a click re-activate the field.

Changes

  • Added FindAction::FocusFindInput, dispatched from a Hoverable wrapped around the find input in CodeEditorFind::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.
  • Extracted CodeEditorFind::activate_find_input (make editable, select the query, focus) and reused it from both the new action handler and View::on_focus, which previously inlined the same logic.
  • Gave the find input a SavePosition (mirroring the existing case_sensitive_button one in the same view) so its bounds can be resolved for mouse events.
  • Vim behaviour is otherwise untouched: Enter still commits the query and moves the caret into the editor, n/N still 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.rs cover 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 a Presenter and dispatch a LeftMouseDown/LeftMouseUp pair at the find input's painted bounds, then assert the input is focused and editable. The Enter case additionally dispatches TypedCharacters through the window and asserts the query became eta while the buffer and the Vim mode were untouched — had Vim received those keystrokes, a would have switched it to Insert mode.

Each test was verified to fail in two ways and pass with the change intact:

  • with the FocusFindInput handler neutralized (the fix itself), and
  • with the Hoverable's on_mouse_down wiring removed, which confirms the click really travels through the new wrapper rather than being simulated.

Checks run:

  • ./script/format
  • cargo clippy -p warp --all-targets --tests -- -D warnings and the same with --features tui (matching the workspace feature unification) — clean
  • cargo nextest run -p warp code::editor:: — 116 passed
  • cargo nextest run -p warp find — 120 passed

Manual verification with the locally built client (cargo run --bin warp) on Linux, with Vim keybindings enabled, on a file opened in the code editor:

  1. / opens Find in File, typing hello shows 3/3 and highlights the three matches.
  2. Enter dims the query, removes the caret from the field, and moves the file cursor to the active match.
  3. Clicking the query text re-activates the field — the query becomes selected and the field is editable again.
  4. Typing eta replaces the query, the counter updates to 1/4, and the highlights follow. Enter re-commits, and clicking once more re-activates the field again.
  • I have manually tested my changes locally

Screenshots / Videos

Computer-use video recordings

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.
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 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 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 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).
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

  • Warp Agent Mode - This PR was created via Warp's AI 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.

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>
@cla-bot cla-bot Bot added the cla-signed label Aug 7, 2026
@warp-agent-staging
warp-agent-staging Bot requested a review from Xavientois August 7, 2026 20:57
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant