diff --git a/yazi-core/src/tab/commands/filter.rs b/yazi-core/src/tab/commands/filter.rs index d0e79241..a6378f8a 100644 --- a/yazi-core/src/tab/commands/filter.rs +++ b/yazi-core/src/tab/commands/filter.rs @@ -11,11 +11,16 @@ use crate::{folder::{Filter, FilterCase}, input::Input, manager::Manager, tab::T pub struct Opt<'a> { pub query: &'a str, pub case: FilterCase, + pub done: bool, } impl<'a> From<&'a Exec> for Opt<'a> { fn from(e: &'a Exec) -> Self { - Self { query: e.args.first().map(|s| s.as_str()).unwrap_or_default(), case: e.into() } + Self { + query: e.args.first().map(|s| s.as_str()).unwrap_or_default(), + case: e.into(), + done: e.named.contains_key("done"), + } } } @@ -28,11 +33,17 @@ impl Tab { let rx = Debounce::new(UnboundedReceiverStream::new(rx), Duration::from_millis(50)); pin!(rx); - while let Some(Ok(s)) | Some(Err(InputError::Typed(s))) = rx.next().await { + while let Some(result) = rx.next().await { + let done = result.is_ok(); + let (Ok(s) | Err(InputError::Typed(s))) = result else { + continue; + }; + emit!(Call( Exec::call("filter_do", vec![s]) .with_bool("smart", opt.case == FilterCase::Smart) .with_bool("insensitive", opt.case == FilterCase::Insensitive) + .with_bool("done", done) .vec(), Layer::Manager )); @@ -51,6 +62,10 @@ impl Tab { return; }; + if opt.done { + Manager::_update_paged(); // Update for paged files in next loop + } + let hovered = self.current.hovered().map(|f| f.url()); if !self.current.files.set_filter(filter) { return;