ZIm/crates/vim/src
Adam Mulvany 0e575b2809
helix: Fix buffer search: deploy reset to normal mode (#36917)
## Fix: Preserve Helix mode when using  search

### Problem
When using `buffer search: deploy` in Helix mode, pressing Enter to
dismiss the search incorrectly returned to Vim NORMAL mode instead of
Helix NORMAL mode.

### Root Cause
The `search_deploy` function was resetting the entire `SearchState` to
default values when buffer search: deploy was activated. Since the
default `Mode` is `Normal`, this caused `prior_mode` to be set to Vim's
Normal mode regardless of the actual mode before search.

### Solution
Modified `search_deploy` to preserve the current mode when resetting
search state:
- Store the current mode before resetting
- Reset search state to default
- Restore the saved mode to `prior_mode`

This ensures the editor returns to the correct mode (Helix NORMAL or Vim
NORMAL) after dismissing buffer search.

### Settings

I was able to reproduce and then test the fix was successful with the
following config and have also tested with vim: default_mode commented
out to ensure that's not influencing the mode selection flow:

```
  "helix_mode": true,
  "vim_mode": true,
  "vim": {
    "default_mode": "helix_normal"
  },
```

This is on Kubuntu 24.04.

The following test combinations pass locally:

- `cargo test -p search`
- `cargo test -p vim` 
- `cargo test -p editor`
- `cargo test -p workspace`
- `cargo test -p gpui -- vim`
- `cargo test -p gpui -- helix`

Release Notes:

- Fixed Helix mode switching to Vim normal mode after using `buffer
search: deploy` to search

Closes #36872
2025-08-26 10:38:53 -06:00
..
digraph Add Vim digraphs (#14887) 2024-07-28 22:44:32 -06:00
normal helix: Fix buffer search: deploy reset to normal mode (#36917) 2025-08-26 10:38:53 -06:00
test Fix clippy::redundant_clone lint violations (#36558) 2025-08-20 12:20:13 +02:00
change_list.rs Remove unnecessary argument from Vim#update_editor (#36001) 2025-08-11 16:10:06 -06:00
command.rs Fix clippy::println_empty_string, clippy::while_let_on_iterator, clippy::while_let_on_iterator lint style violations (#36613) 2025-08-20 20:14:30 +02:00
digraph.rs Fix clippy::len_zero lint style violations (#36589) 2025-08-20 14:35:59 +00:00
helix.rs Add "shift-r" and "g ." support for helix mode (#35468) 2025-08-25 21:37:29 -06:00
indent.rs Remove unnecessary argument from Vim#update_editor (#36001) 2025-08-11 16:10:06 -06:00
insert.rs vim: Add ctrl-y/e in insert mode (#36017) 2025-08-11 23:20:09 -06:00
mode_indicator.rs Fix clippy::redundant_clone lint violations (#36558) 2025-08-20 12:20:13 +02:00
motion.rs vim: Fix cursor jumping past empty lines with inlay hints in visual mode (#35757) 2025-08-21 21:20:22 -06:00
normal.rs Fix iterator related clippy style lint violations (#36437) 2025-08-19 10:06:35 +02:00
object.rs Fix clippy::redundant_clone lint violations (#36558) 2025-08-20 12:20:13 +02:00
replace.rs Remove unnecessary argument from Vim#update_editor (#36001) 2025-08-11 16:10:06 -06:00
rewrap.rs Remove unnecessary argument from Vim#update_editor (#36001) 2025-08-11 16:10:06 -06:00
state.rs Fix workspace migration failure (#36911) 2025-08-26 00:27:52 +00:00
surrounds.rs Auto-fix clippy::collapsible_if violations (#36428) 2025-08-19 13:27:24 +00:00
test.rs lsp: Wait for shutdown response before sending exit notification (#33417) 2025-07-15 18:30:57 +03:00
vim.rs Fix clippy::redundant_clone lint violations (#36558) 2025-08-20 12:20:13 +02:00
visual.rs Fix clippy::redundant_clone lint violations (#36558) 2025-08-20 12:20:13 +02:00