mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
fix: update paged files after filter done (#505)
This commit is contained in:
parent
e41266dbe3
commit
c335b0272b
1 changed files with 17 additions and 2 deletions
|
|
@ -11,11 +11,16 @@ use crate::{folder::{Filter, FilterCase}, input::Input, manager::Manager, tab::T
|
||||||
pub struct Opt<'a> {
|
pub struct Opt<'a> {
|
||||||
pub query: &'a str,
|
pub query: &'a str,
|
||||||
pub case: FilterCase,
|
pub case: FilterCase,
|
||||||
|
pub done: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> From<&'a Exec> for Opt<'a> {
|
impl<'a> From<&'a Exec> for Opt<'a> {
|
||||||
fn from(e: &'a Exec) -> Self {
|
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));
|
let rx = Debounce::new(UnboundedReceiverStream::new(rx), Duration::from_millis(50));
|
||||||
pin!(rx);
|
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(
|
emit!(Call(
|
||||||
Exec::call("filter_do", vec![s])
|
Exec::call("filter_do", vec![s])
|
||||||
.with_bool("smart", opt.case == FilterCase::Smart)
|
.with_bool("smart", opt.case == FilterCase::Smart)
|
||||||
.with_bool("insensitive", opt.case == FilterCase::Insensitive)
|
.with_bool("insensitive", opt.case == FilterCase::Insensitive)
|
||||||
|
.with_bool("done", done)
|
||||||
.vec(),
|
.vec(),
|
||||||
Layer::Manager
|
Layer::Manager
|
||||||
));
|
));
|
||||||
|
|
@ -51,6 +62,10 @@ impl Tab {
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if opt.done {
|
||||||
|
Manager::_update_paged(); // Update for paged files in next loop
|
||||||
|
}
|
||||||
|
|
||||||
let hovered = self.current.hovered().map(|f| f.url());
|
let hovered = self.current.hovered().map(|f| f.url());
|
||||||
if !self.current.files.set_filter(filter) {
|
if !self.current.files.set_filter(filter) {
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue