Restore zed1 behavior for buffer search deploy

This commit is contained in:
Kirill Bulatov 2023-12-15 12:15:20 +02:00
parent 31ff7d40ed
commit 4bfe46f53a

View file

@ -338,7 +338,9 @@ impl BufferSearchBar {
pane.update(cx, |this, cx| { pane.update(cx, |this, cx| {
this.toolbar().update(cx, |this, cx| { this.toolbar().update(cx, |this, cx| {
if let Some(search_bar) = this.item_of_type::<BufferSearchBar>() { if let Some(search_bar) = this.item_of_type::<BufferSearchBar>() {
search_bar.update(cx, |this, cx| this.toggle(deploy, cx)); search_bar.update(cx, |this, cx| {
this.deploy(deploy, cx);
});
return; return;
} }
let view = cx.build_view(|cx| BufferSearchBar::new(cx)); let view = cx.build_view(|cx| BufferSearchBar::new(cx));
@ -1483,9 +1485,9 @@ mod tests {
search_bar.select_all_matches(&SelectAllMatches, cx); search_bar.select_all_matches(&SelectAllMatches, cx);
}); });
assert!( assert!(
editor.update(cx, |this, cx| !this.is_focused(cx.window_context())), editor.update(cx, |this, cx| !this.is_focused(cx.window_context())),
"Should not switch focus to editor if SelectAllMatches does not find any matches" "Should not switch focus to editor if SelectAllMatches does not find any matches"
); );
search_bar.update(cx, |search_bar, cx| { search_bar.update(cx, |search_bar, cx| {
let all_selections = let all_selections =
editor.update(cx, |editor, cx| editor.selections.display_ranges(cx)); editor.update(cx, |editor, cx| editor.selections.display_ranges(cx));
@ -1651,6 +1653,7 @@ mod tests {
assert_eq!(search_bar.search_options, SearchOptions::NONE); assert_eq!(search_bar.search_options, SearchOptions::NONE);
}); });
} }
#[gpui::test] #[gpui::test]
async fn test_replace_simple(cx: &mut TestAppContext) { async fn test_replace_simple(cx: &mut TestAppContext) {
let (editor, search_bar, cx) = init_test(cx); let (editor, search_bar, cx) = init_test(cx);