Make BufferSearch less wide (#10459)
This also adds some "responsiveness" so that UI elements are hidden before everything has to be occluded Release Notes: - Improved search UI. It now works in narrower panes, and avoids scrolling the editor on open. <img width="899" alt="Screenshot 2024-04-11 at 21 33 17" src="https://github.com/zed-industries/zed/assets/94272/44b95d4f-08d6-4c40-a175-0e594402ca01"> <img width="508" alt="Screenshot 2024-04-11 at 21 33 45" src="https://github.com/zed-industries/zed/assets/94272/baf4638d-427b-43e6-ad67-13d43f0f18a2"> <img width="361" alt="Screenshot 2024-04-11 at 21 34 00" src="https://github.com/zed-industries/zed/assets/94272/ff60b561-2f77-49c0-9df7-e26227fe9225"> <img width="348" alt="Screenshot 2024-04-11 at 21 37 03" src="https://github.com/zed-industries/zed/assets/94272/a2a700a2-ce99-41bd-bf47-9b14d7082b0e">
This commit is contained in:
parent
f2d61f3ea5
commit
08786fa7bf
18 changed files with 326 additions and 482 deletions
|
@ -55,6 +55,8 @@ pub trait SearchableItem: Item + EventEmitter<SearchEvent> {
|
|||
}
|
||||
}
|
||||
|
||||
fn search_bar_visibility_changed(&mut self, _visible: bool, _cx: &mut ViewContext<Self>) {}
|
||||
|
||||
fn clear_matches(&mut self, cx: &mut ViewContext<Self>);
|
||||
fn update_matches(&mut self, matches: &[Self::Match], cx: &mut ViewContext<Self>);
|
||||
fn query_suggestion(&mut self, cx: &mut ViewContext<Self>) -> String;
|
||||
|
@ -131,6 +133,7 @@ pub trait SearchableItemHandle: ItemHandle {
|
|||
matches: &AnyVec<dyn Send>,
|
||||
cx: &mut WindowContext,
|
||||
) -> Option<usize>;
|
||||
fn search_bar_visibility_changed(&self, visible: bool, cx: &mut WindowContext);
|
||||
}
|
||||
|
||||
impl<T: SearchableItem> SearchableItemHandle for View<T> {
|
||||
|
@ -227,6 +230,12 @@ impl<T: SearchableItem> SearchableItemHandle for View<T> {
|
|||
let mat = mat.downcast_ref().unwrap();
|
||||
self.update(cx, |this, cx| this.replace(mat, query, cx))
|
||||
}
|
||||
|
||||
fn search_bar_visibility_changed(&self, visible: bool, cx: &mut WindowContext) {
|
||||
self.update(cx, |this, cx| {
|
||||
this.search_bar_visibility_changed(visible, cx)
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Box<dyn SearchableItemHandle>> for AnyView {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue