vim: Implement /n and /c in :s (#34102)

Closes #23345

Release Notes:

- vim: Support /n and /c in :s//
This commit is contained in:
Conrad Irwin 2025-07-09 00:14:04 -06:00 committed by GitHub
parent 6daf888fdb
commit 4ed206b37c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 263 additions and 81 deletions

View file

@ -939,6 +939,11 @@ impl BufferSearchBar {
});
}
pub fn focus_replace(&mut self, window: &mut Window, cx: &mut Context<Self>) {
self.focus(&self.replacement_editor.focus_handle(cx), window, cx);
cx.notify();
}
pub fn search(
&mut self,
query: &str,
@ -1092,6 +1097,21 @@ impl BufferSearchBar {
}
}
pub fn select_first_match(&mut self, window: &mut Window, cx: &mut Context<Self>) {
if let Some(searchable_item) = self.active_searchable_item.as_ref() {
if let Some(matches) = self
.searchable_items_with_matches
.get(&searchable_item.downgrade())
{
if matches.is_empty() {
return;
}
searchable_item.update_matches(matches, window, cx);
searchable_item.activate_match(0, matches, window, cx);
}
}
}
pub fn select_last_match(&mut self, window: &mut Window, cx: &mut Context<Self>) {
if let Some(searchable_item) = self.active_searchable_item.as_ref() {
if let Some(matches) = self