mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
Open file on right arrow
This commit is contained in:
parent
3f5cc47a48
commit
b91f0427a9
1 changed files with 7 additions and 4 deletions
|
|
@ -1,5 +1,5 @@
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use yazi_core::mgr::CdSource;
|
use yazi_core::mgr::{CdSource, OpenOpt};
|
||||||
use yazi_macro::{act, succ};
|
use yazi_macro::{act, succ};
|
||||||
use yazi_parser::VoidForm;
|
use yazi_parser::VoidForm;
|
||||||
use yazi_shared::{data::Data, url::UrlLike};
|
use yazi_shared::{data::Data, url::UrlLike};
|
||||||
|
|
@ -14,10 +14,13 @@ impl Actor for Enter {
|
||||||
const NAME: &str = "enter";
|
const NAME: &str = "enter";
|
||||||
|
|
||||||
fn act(cx: &mut Ctx, _: Self::Form) -> Result<Data> {
|
fn act(cx: &mut Ctx, _: Self::Form) -> Result<Data> {
|
||||||
let Some(h) = cx.hovered().filter(|h| h.is_dir()) else { succ!() };
|
let Some(h) = cx.hovered() else { succ!() };
|
||||||
|
|
||||||
let url = if h.url.is_search() { h.url.to_regular()? } else { h.url.clone() };
|
if h.is_dir() {
|
||||||
|
let url = if h.url.is_search() { h.url.to_regular()? } else { h.url.clone() };
|
||||||
|
return act!(mgr:cd, cx, (url, CdSource::Enter));
|
||||||
|
}
|
||||||
|
|
||||||
act!(mgr:cd, cx, (url, CdSource::Enter))
|
act!(mgr:open, cx, OpenOpt { cwd: None, targets: vec![], interactive: false, hovered: true })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue