mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
update: add find --clear option
run find --clear command to clear find
This commit is contained in:
parent
5e48df5126
commit
d019fc47fc
1 changed files with 15 additions and 2 deletions
|
|
@ -14,11 +14,17 @@ pub(super) struct Opt {
|
||||||
pub(super) query: Option<String>,
|
pub(super) query: Option<String>,
|
||||||
pub(super) prev: bool,
|
pub(super) prev: bool,
|
||||||
pub(super) case: FilterCase,
|
pub(super) case: FilterCase,
|
||||||
|
pub(super) clear: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<Cmd> for Opt {
|
impl From<Cmd> for Opt {
|
||||||
fn from(mut c: Cmd) -> Self {
|
fn from(mut c: Cmd) -> Self {
|
||||||
Self { query: c.take_first_str(), prev: c.bool("previous"), case: FilterCase::from(&c) }
|
Self {
|
||||||
|
query: c.take_first_str(),
|
||||||
|
prev: c.bool("previous"),
|
||||||
|
clear: c.bool("clear"),
|
||||||
|
case: FilterCase::from(&c),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -26,8 +32,15 @@ impl Tab {
|
||||||
#[yazi_codegen::command]
|
#[yazi_codegen::command]
|
||||||
pub fn find(&mut self, opt: Opt) {
|
pub fn find(&mut self, opt: Opt) {
|
||||||
tokio::spawn(async move {
|
tokio::spawn(async move {
|
||||||
let rx = InputProxy::show(InputCfg::find(opt.prev));
|
if opt.clear {
|
||||||
|
emit!(Call(
|
||||||
|
Cmd::args("find_do", &[""]),
|
||||||
|
Layer::Manager
|
||||||
|
));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let rx = InputProxy::show(InputCfg::find(opt.prev));
|
||||||
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);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue