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
+8 -4
View File
@@ -11,7 +11,7 @@ use gpui::{
DispatchPhase, ElementId, Entity, EntityInputHandler, EventEmitter, Font, HitboxBehavior,
InteractiveElement as _, IntoElement, KeyBinding, KeyDownEvent, MouseButton, MouseDownEvent,
MouseMoveEvent, MouseUpEvent, ParentElement as _, Pixels, RenderOnce, Role, ScrollDelta,
ScrollEvent, SharedString, StatefulInteractiveElement as _, Styled as _, Subscription,
ScrollEvent, SharedString, StatefulInteractiveElement as _, Styled as _, Subscription, Task,
TextAlign, TextRun, UTF16Selection, Window, WrappedLine, actions, canvas, div, fill, point, px,
};
use gpui_native_icons::IconRole;
@@ -483,6 +483,8 @@ struct CaretBlink {
visible: bool,
active: bool,
paused: bool,
/// Pending blink timers; held so they die with the controller.
tasks: Vec<Task<()>>,
}
impl CaretBlink {
@@ -493,6 +495,7 @@ impl CaretBlink {
visible: true,
active: false,
paused: false,
tasks: Vec::new(),
}
}
@@ -550,7 +553,7 @@ impl CaretBlink {
fn schedule_pause(&mut self, cx: &mut Context<Self>) {
let generation = self.generation;
let interval = self.interval;
cx.spawn(async move |this, cx| {
let task = cx.spawn(async move |this, cx| {
cx.background_executor().timer(interval).await;
this.update(cx, |this, cx| {
if this.generation == generation {
@@ -558,8 +561,9 @@ impl CaretBlink {
this.tick(cx);
}
})
})
.detach();
.ok();
});
self.tasks.push(task);
}
}