feat: add combobox filter

This commit is contained in:
2026-11-06 21:27:31 +07:00
parent 265d2d129b
commit 0ad5c3fe90
8 changed files with 256 additions and 65 deletions
+9 -8
View File
@@ -7,7 +7,7 @@ use gpui::prelude::FluentBuilder as _;
use gpui::{
Animation, AnimationExt as _, App, Context, ElementId, Entity, InteractiveElement as _,
IntoElement, ParentElement as _, RenderOnce, SharedString, StatefulInteractiveElement as _,
Styled as _, Window, deferred, div, ease_out_quint, px,
Styled as _, Task, Window, deferred, div, ease_out_quint, px,
};
use gpui_native_icons::{IconRole, icon};
use gpui_native_theme::ActiveTheme as _;
@@ -107,6 +107,8 @@ pub struct Toasts {
current: Option<ToastEntry>,
exiting: Option<ToastEntry>,
next_id: usize,
/// Pending dismiss and fade timers; held so they die with the store.
tasks: Vec<Task<()>>,
}
impl Toasts {
@@ -125,11 +127,11 @@ impl Toasts {
cx.notify();
if let Some(duration) = duration.filter(|duration| !duration.is_zero()) {
cx.spawn(async move |this, cx| {
let task = cx.spawn(async move |this, cx| {
cx.background_executor().timer(duration).await;
this.update(cx, |toasts, cx| toasts.dismiss(id, cx)).ok();
})
.detach();
});
self.tasks.push(task);
}
id
@@ -178,12 +180,11 @@ impl Toasts {
cx.notify();
let fade = cx.theme().motion.overlay;
cx.spawn(async move |this, cx| {
let task = cx.spawn(async move |this, cx| {
cx.background_executor().timer(fade).await;
this.update(cx, |toasts, cx| toasts.finish_exit(cx)).ok();
})
.detach();
});
self.tasks.push(task);
}
fn finish_exit(&mut self, cx: &mut Context<Self>) {