mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
22 lines
505 B
Rust
22 lines
505 B
Rust
use anyhow::Result;
|
|
use yazi_macro::{act, succ};
|
|
use yazi_parser::{VoidOpt, mgr::CdSource};
|
|
use yazi_shared::event::Data;
|
|
|
|
use crate::{Actor, Ctx};
|
|
|
|
pub struct Enter;
|
|
|
|
impl Actor for Enter {
|
|
type Options = VoidOpt;
|
|
|
|
const NAME: &str = "enter";
|
|
|
|
fn act(cx: &mut Ctx, _: Self::Options) -> Result<Data> {
|
|
let Some(h) = cx.hovered().filter(|h| h.is_dir()) else { succ!() };
|
|
|
|
let url = if h.url.is_search() { h.url.to_regular() } else { h.url.clone() };
|
|
|
|
act!(mgr:cd, cx, (url, CdSource::Enter))
|
|
}
|
|
}
|