Implement picker actions

Co-authored-by: Mikayla <mikayla@zed.dev>
This commit is contained in:
Max Brunsfeld 2023-11-07 09:46:41 -08:00
parent 69eb49a2ed
commit 1d34b7b9fe
2 changed files with 61 additions and 16 deletions

View file

@ -48,9 +48,27 @@ impl PickerDelegate for PickerStory {
&mut self,
ix: usize,
_picker_id: gpui::ElementId,
_cx: &mut gpui::ViewContext<Self>,
cx: &mut gpui::ViewContext<Self>,
) {
self.selected_ix = ix;
cx.notify();
}
fn confirm(
&mut self,
secondary: bool,
picker_id: gpui::ElementId,
cx: &mut gpui::ViewContext<Self>,
) {
if secondary {
eprintln!("Secondary confirmed {}", self.candidates[self.selected_ix])
} else {
eprintln!("Confirmed {}", self.candidates[self.selected_ix])
}
}
fn dismissed(&mut self, picker_id: gpui::ElementId, cx: &mut gpui::ViewContext<Self>) {
cx.quit();
}
}