vim: Change into visual mode on select all matches (#24897)

This Pull Request fixes an issue where selecting all matches on a search
would not update vim to visual mode.

In the video below the following scenarios are tested:

1. Clicking "Select All Matches" in the buffer search bar correctly
changes vim to visual mode
2. Pressing Enter jumps the cursor to the first match and does not
change vim's mode
3. Selecting all matches with the `⌥⏎` changes vim to visual mode


https://github.com/user-attachments/assets/f7535638-987e-4f33-9364-292f99b60167

Thanks @ConradIrwin for both the quick pairing session and the solution!
🙇

Closes #14681 

Release Notes:

- vim: Use visual mode for "select all matches" in search (to be
consistent with `ga`)
This commit is contained in:
Dino 2025-02-14 19:37:35 +00:00 committed by GitHub
parent fc85ca0101
commit 294dea10e8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1401,11 +1401,9 @@ impl SearchableItem for Editor {
cx: &mut Context<Self>,
) {
self.unfold_ranges(matches, false, false, cx);
let mut ranges = Vec::new();
for m in matches {
ranges.push(self.range_for_match(m))
}
self.change_selections(None, window, cx, |s| s.select_ranges(ranges));
self.change_selections(None, window, cx, |s| {
s.select_ranges(matches.iter().cloned())
});
}
fn replace(
&mut self,