mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-21 23:01:05 +00:00
refactor: pull the process API out into yazi-binding crate (#3830)
This commit is contained in:
parent
607bc0dd2b
commit
4225c34fea
195 changed files with 782 additions and 778 deletions
3
Cargo.lock
generated
3
Cargo.lock
generated
|
|
@ -5631,6 +5631,7 @@ dependencies = [
|
|||
"crossterm 0.29.0",
|
||||
"futures",
|
||||
"hashbrown 0.16.1",
|
||||
"libc",
|
||||
"mlua",
|
||||
"paste",
|
||||
"ratatui",
|
||||
|
|
@ -5639,6 +5640,7 @@ dependencies = [
|
|||
"tokio-stream",
|
||||
"tracing",
|
||||
"unicode-width",
|
||||
"windows-sys 0.61.2",
|
||||
"yazi-adapter",
|
||||
"yazi-codegen",
|
||||
"yazi-config",
|
||||
|
|
@ -5949,7 +5951,6 @@ dependencies = [
|
|||
"twox-hash",
|
||||
"unicode-width",
|
||||
"uzers",
|
||||
"windows-sys 0.61.2",
|
||||
"yazi-adapter",
|
||||
"yazi-binding",
|
||||
"yazi-boot",
|
||||
|
|
|
|||
|
|
@ -5,11 +5,11 @@ use yazi_shared::data::Data;
|
|||
use crate::Ctx;
|
||||
|
||||
pub trait Actor {
|
||||
type Options;
|
||||
type Form;
|
||||
|
||||
const NAME: &str;
|
||||
|
||||
fn act(cx: &mut Ctx, opt: Self::Options) -> Result<Data>;
|
||||
fn act(cx: &mut Ctx, form: Self::Form) -> Result<Data>;
|
||||
|
||||
fn hook(_cx: &Ctx, _opt: &Self::Options) -> Option<SparkKind> { None }
|
||||
fn hook(_cx: &Ctx, _form: &Self::Form) -> Option<SparkKind> { None }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ use crate::{Actor, Ctx};
|
|||
pub struct AcceptPayload;
|
||||
|
||||
impl Actor for AcceptPayload {
|
||||
type Options = Payload<'static>;
|
||||
type Form = Payload<'static>;
|
||||
|
||||
const NAME: &str = "accept_payload";
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ use anyhow::Result;
|
|||
use yazi_actor::Ctx;
|
||||
use yazi_boot::BOOT;
|
||||
use yazi_macro::{act, succ};
|
||||
use yazi_parser::{VoidOpt, mgr::CdSource};
|
||||
use yazi_parser::{VoidForm, mgr::CdSource};
|
||||
use yazi_shared::{data::Data, strand::StrandLike, url::UrlLike};
|
||||
|
||||
use crate::Actor;
|
||||
|
|
@ -10,11 +10,11 @@ use crate::Actor;
|
|||
pub struct Bootstrap;
|
||||
|
||||
impl Actor for Bootstrap {
|
||||
type Options = VoidOpt;
|
||||
type Form = VoidForm;
|
||||
|
||||
const NAME: &str = "bootstrap";
|
||||
|
||||
fn act(cx: &mut Ctx, _: Self::Options) -> Result<Data> {
|
||||
fn act(cx: &mut Ctx, _: Self::Form) -> Result<Data> {
|
||||
cx.mgr.tabs.resize_with(BOOT.files.len(), Default::default);
|
||||
|
||||
for (i, file) in BOOT.files.iter().enumerate().rev() {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
use anyhow::Result;
|
||||
use yazi_core::notify::{MessageLevel, MessageOpt};
|
||||
use yazi_macro::act;
|
||||
use yazi_parser::app::DeprecateOpt;
|
||||
use yazi_parser::app::DeprecateForm;
|
||||
use yazi_shared::data::Data;
|
||||
|
||||
use crate::{Actor, Ctx};
|
||||
|
|
@ -9,11 +9,11 @@ use crate::{Actor, Ctx};
|
|||
pub struct Deprecate;
|
||||
|
||||
impl Actor for Deprecate {
|
||||
type Options = DeprecateOpt;
|
||||
type Form = DeprecateForm;
|
||||
|
||||
const NAME: &str = "deprecate";
|
||||
|
||||
fn act(cx: &mut Ctx, opt: Self::Options) -> Result<Data> {
|
||||
fn act(cx: &mut Ctx, opt: Self::Form) -> Result<Data> {
|
||||
act!(notify:push, cx, MessageOpt {
|
||||
title: "Deprecated API".to_owned(),
|
||||
content: opt.content.into_owned(),
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
use anyhow::Result;
|
||||
use yazi_actor::Ctx;
|
||||
use yazi_macro::act;
|
||||
use yazi_parser::VoidOpt;
|
||||
use yazi_parser::VoidForm;
|
||||
use yazi_shared::data::Data;
|
||||
|
||||
use crate::Actor;
|
||||
|
|
@ -9,9 +9,9 @@ use crate::Actor;
|
|||
pub struct Focus;
|
||||
|
||||
impl Actor for Focus {
|
||||
type Options = VoidOpt;
|
||||
type Form = VoidForm;
|
||||
|
||||
const NAME: &str = "focus";
|
||||
|
||||
fn act(cx: &mut Ctx, _: Self::Options) -> Result<Data> { act!(mgr:refresh, cx) }
|
||||
fn act(cx: &mut Ctx, _: Self::Form) -> Result<Data> { act!(mgr:refresh, cx) }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ use anyhow::Result;
|
|||
use yazi_binding::runtime_scope;
|
||||
use yazi_dds::Sendable;
|
||||
use yazi_macro::succ;
|
||||
use yazi_parser::app::LuaOpt;
|
||||
use yazi_parser::app::LuaForm;
|
||||
use yazi_plugin::LUA;
|
||||
use yazi_shared::data::Data;
|
||||
|
||||
|
|
@ -11,11 +11,11 @@ use crate::{Actor, Ctx, lives::Lives};
|
|||
pub struct Lua;
|
||||
|
||||
impl Actor for Lua {
|
||||
type Options = LuaOpt;
|
||||
type Form = LuaForm;
|
||||
|
||||
const NAME: &str = "lua";
|
||||
|
||||
fn act(cx: &mut Ctx, opt: Self::Options) -> Result<Data> {
|
||||
fn act(cx: &mut Ctx, opt: Self::Form) -> Result<Data> {
|
||||
let chunk = LUA.load(&*opt.code).set_name("anonymous");
|
||||
let result = Lives::scope(cx.core, || {
|
||||
runtime_scope!(LUA, "inline", Sendable::value_to_data(&LUA, chunk.eval()?))
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ use yazi_actor::lives::Lives;
|
|||
use yazi_binding::runtime_scope;
|
||||
use yazi_config::YAZI;
|
||||
use yazi_macro::succ;
|
||||
use yazi_parser::app::MouseOpt;
|
||||
use yazi_parser::app::MouseForm;
|
||||
use yazi_plugin::LUA;
|
||||
use yazi_shared::data::Data;
|
||||
|
||||
|
|
@ -15,11 +15,11 @@ use crate::{Actor, Ctx};
|
|||
pub struct Mouse;
|
||||
|
||||
impl Actor for Mouse {
|
||||
type Options = MouseOpt;
|
||||
type Form = MouseForm;
|
||||
|
||||
const NAME: &str = "mouse";
|
||||
|
||||
fn act(cx: &mut Ctx, opt: Self::Options) -> Result<Data> {
|
||||
fn act(cx: &mut Ctx, opt: Self::Form) -> Result<Data> {
|
||||
let event = yazi_binding::MouseEvent::from(opt.event);
|
||||
|
||||
let Some(size) = cx.term.as_ref().and_then(|t| t.size().ok()) else { succ!() };
|
||||
|
|
|
|||
|
|
@ -11,11 +11,11 @@ use crate::{Actor, Ctx};
|
|||
pub struct Plugin;
|
||||
|
||||
impl Actor for Plugin {
|
||||
type Options = PluginForm;
|
||||
type Form = PluginForm;
|
||||
|
||||
const NAME: &str = "plugin";
|
||||
|
||||
fn act(cx: &mut Ctx, Self::Options { mut opt }: Self::Options) -> Result<Data> {
|
||||
fn act(cx: &mut Ctx, Self::Form { mut opt }: Self::Form) -> Result<Data> {
|
||||
let mut hits = false;
|
||||
if let Some(chunk) = LOADER.read().get(&*opt.id) {
|
||||
hits = true;
|
||||
|
|
|
|||
|
|
@ -16,11 +16,11 @@ use crate::{Actor, Ctx, lives::Lives};
|
|||
pub struct PluginDo;
|
||||
|
||||
impl Actor for PluginDo {
|
||||
type Options = PluginForm;
|
||||
type Form = PluginForm;
|
||||
|
||||
const NAME: &str = "plugin_do";
|
||||
|
||||
fn act(cx: &mut Ctx, Self::Options { opt }: Self::Options) -> Result<Data> {
|
||||
fn act(cx: &mut Ctx, Self::Form { opt }: Self::Form) -> Result<Data> {
|
||||
let loader = LOADER.read();
|
||||
let Some(chunk) = loader.get(&*opt.id) else {
|
||||
succ!(warn!("plugin `{}` not found", opt.id));
|
||||
|
|
|
|||
|
|
@ -10,11 +10,11 @@ use crate::{Actor, Ctx};
|
|||
pub struct Quit;
|
||||
|
||||
impl Actor for Quit {
|
||||
type Options = QuitForm;
|
||||
type Form = QuitForm;
|
||||
|
||||
const NAME: &str = "quit";
|
||||
|
||||
fn act(cx: &mut Ctx, Self::Options { opt }: Self::Options) -> Result<Data> {
|
||||
fn act(cx: &mut Ctx, Self::Form { opt }: Self::Form) -> Result<Data> {
|
||||
cx.tasks.shutdown();
|
||||
cx.mgr.shutdown();
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ use tracing::error;
|
|||
use yazi_actor::lives::Lives;
|
||||
use yazi_config::LAYOUT;
|
||||
use yazi_macro::{render, succ};
|
||||
use yazi_parser::app::ReflowOpt;
|
||||
use yazi_parser::app::ReflowForm;
|
||||
use yazi_shared::data::Data;
|
||||
|
||||
use crate::{Actor, Ctx};
|
||||
|
|
@ -13,11 +13,11 @@ use crate::{Actor, Ctx};
|
|||
pub struct Reflow;
|
||||
|
||||
impl Actor for Reflow {
|
||||
type Options = ReflowOpt;
|
||||
type Form = ReflowForm;
|
||||
|
||||
const NAME: &str = "reflow";
|
||||
|
||||
fn act(cx: &mut Ctx, opt: Self::Options) -> Result<Data> {
|
||||
fn act(cx: &mut Ctx, opt: Self::Form) -> Result<Data> {
|
||||
let Some(size) = cx.term.as_ref().and_then(|t| t.size().ok()) else { succ!() };
|
||||
let mut layout = LAYOUT.get();
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
use anyhow::Result;
|
||||
use yazi_actor::Ctx;
|
||||
use yazi_macro::act;
|
||||
use yazi_parser::app::ReflowOpt;
|
||||
use yazi_parser::app::ReflowForm;
|
||||
use yazi_shared::data::Data;
|
||||
|
||||
use crate::Actor;
|
||||
|
|
@ -9,11 +9,11 @@ use crate::Actor;
|
|||
pub struct Resize;
|
||||
|
||||
impl Actor for Resize {
|
||||
type Options = ReflowOpt;
|
||||
type Form = ReflowForm;
|
||||
|
||||
const NAME: &str = "resize";
|
||||
|
||||
fn act(cx: &mut Ctx, opt: Self::Options) -> Result<Data> {
|
||||
fn act(cx: &mut Ctx, opt: Self::Form) -> Result<Data> {
|
||||
act!(app:reflow, cx, opt)?;
|
||||
|
||||
cx.current_mut().arrow(0);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use anyhow::Result;
|
||||
use yazi_macro::{act, render, succ};
|
||||
use yazi_parser::app::ResumeOpt;
|
||||
use yazi_parser::app::ResumeForm;
|
||||
use yazi_shared::data::Data;
|
||||
use yazi_term::Term;
|
||||
|
||||
|
|
@ -9,11 +9,11 @@ use crate::{Actor, Ctx};
|
|||
pub struct Resume;
|
||||
|
||||
impl Actor for Resume {
|
||||
type Options = ResumeOpt;
|
||||
type Form = ResumeForm;
|
||||
|
||||
const NAME: &str = "resume";
|
||||
|
||||
fn act(cx: &mut Ctx, opt: Self::Options) -> Result<Data> {
|
||||
fn act(cx: &mut Ctx, opt: Self::Form) -> Result<Data> {
|
||||
cx.active_mut().preview.reset();
|
||||
*cx.term = Some(Term::start()?);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use anyhow::Result;
|
||||
use yazi_macro::succ;
|
||||
use yazi_parser::app::StopOpt;
|
||||
use yazi_parser::app::StopForm;
|
||||
use yazi_shared::data::Data;
|
||||
|
||||
use crate::{Actor, Ctx};
|
||||
|
|
@ -8,11 +8,11 @@ use crate::{Actor, Ctx};
|
|||
pub struct Stop;
|
||||
|
||||
impl Actor for Stop {
|
||||
type Options = StopOpt;
|
||||
type Form = StopForm;
|
||||
|
||||
const NAME: &str = "stop";
|
||||
|
||||
fn act(cx: &mut Ctx, opt: Self::Options) -> Result<Data> {
|
||||
fn act(cx: &mut Ctx, opt: Self::Form) -> Result<Data> {
|
||||
cx.active_mut().preview.reset_image();
|
||||
|
||||
// We need to destroy the `term` first before stopping the `signals`
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ use anyhow::Result;
|
|||
use crossterm::{execute, terminal::SetTitle};
|
||||
use yazi_actor::Ctx;
|
||||
use yazi_macro::succ;
|
||||
use yazi_parser::{app::TitleOpt, spark::SparkKind};
|
||||
use yazi_parser::{app::TitleForm, spark::SparkKind};
|
||||
use yazi_shared::{Source, data::Data};
|
||||
use yazi_term::TermState;
|
||||
use yazi_tty::TTY;
|
||||
|
|
@ -12,11 +12,11 @@ use crate::Actor;
|
|||
pub struct Title;
|
||||
|
||||
impl Actor for Title {
|
||||
type Options = TitleOpt;
|
||||
type Form = TitleForm;
|
||||
|
||||
const NAME: &str = "title";
|
||||
|
||||
fn act(cx: &mut Ctx, opt: Self::Options) -> Result<Data> {
|
||||
fn act(cx: &mut Ctx, opt: Self::Form) -> Result<Data> {
|
||||
let s = opt.value.unwrap_or_else(|| format!("Yazi: {}", cx.tab().name()).into());
|
||||
execute!(TTY.writer(), SetTitle(&s))?;
|
||||
|
||||
|
|
@ -24,7 +24,7 @@ impl Actor for Title {
|
|||
succ!()
|
||||
}
|
||||
|
||||
fn hook(cx: &Ctx, _opt: &Self::Options) -> Option<SparkKind> {
|
||||
fn hook(cx: &Ctx, _opt: &Self::Form) -> Option<SparkKind> {
|
||||
match cx.source() {
|
||||
Source::Ind => Some(SparkKind::IndAppTitle),
|
||||
_ => None,
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
use anyhow::Result;
|
||||
use yazi_actor::Ctx;
|
||||
use yazi_macro::{act, render, render_partial, succ};
|
||||
use yazi_parser::app::UpdateProgressOpt;
|
||||
use yazi_parser::app::UpdateProgressForm;
|
||||
use yazi_shared::data::Data;
|
||||
|
||||
use crate::Actor;
|
||||
|
|
@ -9,11 +9,11 @@ use crate::Actor;
|
|||
pub struct UpdateProgress;
|
||||
|
||||
impl Actor for UpdateProgress {
|
||||
type Options = UpdateProgressOpt;
|
||||
type Form = UpdateProgressForm;
|
||||
|
||||
const NAME: &str = "update_progress";
|
||||
|
||||
fn act(cx: &mut Ctx, opt: Self::Options) -> Result<Data> {
|
||||
fn act(cx: &mut Ctx, opt: Self::Form) -> Result<Data> {
|
||||
// Update the progress of all tasks.
|
||||
let tasks = &mut cx.tasks;
|
||||
let progressed = tasks.summary != opt.summary;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use anyhow::Result;
|
||||
use yazi_macro::{render, succ};
|
||||
use yazi_parser::ArrowOpt;
|
||||
use yazi_parser::ArrowForm;
|
||||
use yazi_shared::data::Data;
|
||||
use yazi_widgets::Scrollable;
|
||||
|
||||
|
|
@ -9,11 +9,11 @@ use crate::{Actor, Ctx};
|
|||
pub struct Arrow;
|
||||
|
||||
impl Actor for Arrow {
|
||||
type Options = ArrowOpt;
|
||||
type Form = ArrowForm;
|
||||
|
||||
const NAME: &str = "arrow";
|
||||
|
||||
fn act(cx: &mut Ctx, opt: Self::Options) -> Result<Data> {
|
||||
fn act(cx: &mut Ctx, opt: Self::Form) -> Result<Data> {
|
||||
succ!(render!(cx.cmp.scroll(opt.step)));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ use std::mem;
|
|||
|
||||
use anyhow::Result;
|
||||
use yazi_macro::{act, render, succ};
|
||||
use yazi_parser::cmp::CloseOpt;
|
||||
use yazi_parser::cmp::CloseForm;
|
||||
use yazi_shared::data::Data;
|
||||
use yazi_widgets::input::parser::CompleteOpt;
|
||||
|
||||
|
|
@ -11,11 +11,11 @@ use crate::{Actor, Ctx};
|
|||
pub struct Close;
|
||||
|
||||
impl Actor for Close {
|
||||
type Options = CloseOpt;
|
||||
type Form = CloseForm;
|
||||
|
||||
const NAME: &str = "close";
|
||||
|
||||
fn act(cx: &mut Ctx, opt: Self::Options) -> Result<Data> {
|
||||
fn act(cx: &mut Ctx, opt: Self::Form) -> Result<Data> {
|
||||
let cmp = &mut cx.cmp;
|
||||
if let Some(item) = cmp.selected().filter(|_| opt.submit).cloned() {
|
||||
return act!(input:complete, cx, CompleteOpt { name: item.name, is_dir: item.is_dir, ticket: cmp.ticket });
|
||||
|
|
|
|||
|
|
@ -13,11 +13,11 @@ const LIMIT: usize = 30;
|
|||
pub struct Show;
|
||||
|
||||
impl Actor for Show {
|
||||
type Options = ShowForm;
|
||||
type Form = ShowForm;
|
||||
|
||||
const NAME: &str = "show";
|
||||
|
||||
fn act(cx: &mut Ctx, Self::Options { opt }: Self::Options) -> Result<Data> {
|
||||
fn act(cx: &mut Ctx, Self::Form { opt }: Self::Form) -> Result<Data> {
|
||||
let cmp = &mut cx.cmp;
|
||||
if cmp.ticket != opt.ticket {
|
||||
succ!();
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ use anyhow::Result;
|
|||
use yazi_core::cmp::{CmpItem, CmpOpt};
|
||||
use yazi_fs::{path::clean_url, provider::{DirReader, FileHolder}};
|
||||
use yazi_macro::{act, render, succ};
|
||||
use yazi_parser::cmp::TriggerOpt;
|
||||
use yazi_parser::cmp::TriggerForm;
|
||||
use yazi_proxy::CmpProxy;
|
||||
use yazi_shared::{AnyAsciiChar, BytePredictor, data::Data, natsort, path::{AsPath, PathBufDyn, PathLike}, scheme::{SchemeCow, SchemeLike}, strand::{AsStrand, StrandLike}, url::{UrlBuf, UrlCow, UrlLike}};
|
||||
use yazi_vfs::provider;
|
||||
|
|
@ -14,11 +14,11 @@ use crate::{Actor, Ctx};
|
|||
pub struct Trigger;
|
||||
|
||||
impl Actor for Trigger {
|
||||
type Options = TriggerOpt;
|
||||
type Form = TriggerForm;
|
||||
|
||||
const NAME: &str = "trigger";
|
||||
|
||||
fn act(cx: &mut Ctx, opt: Self::Options) -> Result<Data> {
|
||||
fn act(cx: &mut Ctx, opt: Self::Form) -> Result<Data> {
|
||||
if opt.ticket.is_some_and(|t| t != cx.cmp.ticket) {
|
||||
succ!();
|
||||
} else if opt.ticket.is_none() {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use anyhow::Result;
|
||||
use yazi_macro::{render, succ};
|
||||
use yazi_parser::ArrowOpt;
|
||||
use yazi_parser::ArrowForm;
|
||||
use yazi_shared::data::Data;
|
||||
|
||||
use crate::{Actor, Ctx};
|
||||
|
|
@ -8,11 +8,11 @@ use crate::{Actor, Ctx};
|
|||
pub struct Arrow;
|
||||
|
||||
impl Actor for Arrow {
|
||||
type Options = ArrowOpt;
|
||||
type Form = ArrowForm;
|
||||
|
||||
const NAME: &str = "arrow";
|
||||
|
||||
fn act(cx: &mut Ctx, opt: Self::Options) -> Result<Data> {
|
||||
fn act(cx: &mut Ctx, opt: Self::Form) -> Result<Data> {
|
||||
let confirm = &mut cx.core.confirm;
|
||||
|
||||
let area = cx.core.mgr.area(confirm.position);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use anyhow::Result;
|
||||
use yazi_macro::{render, succ};
|
||||
use yazi_parser::confirm::CloseOpt;
|
||||
use yazi_parser::confirm::CloseForm;
|
||||
use yazi_shared::data::Data;
|
||||
|
||||
use crate::{Actor, Ctx};
|
||||
|
|
@ -8,11 +8,11 @@ use crate::{Actor, Ctx};
|
|||
pub struct Close;
|
||||
|
||||
impl Actor for Close {
|
||||
type Options = CloseOpt;
|
||||
type Form = CloseForm;
|
||||
|
||||
const NAME: &str = "close";
|
||||
|
||||
fn act(cx: &mut Ctx, opt: Self::Options) -> Result<Data> {
|
||||
fn act(cx: &mut Ctx, opt: Self::Form) -> Result<Data> {
|
||||
cx.confirm.token.complete(opt.submit);
|
||||
cx.confirm.visible = false;
|
||||
succ!(render!());
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use anyhow::Result;
|
||||
use yazi_macro::{act, render, succ};
|
||||
use yazi_parser::confirm::ShowOpt;
|
||||
use yazi_parser::confirm::ShowForm;
|
||||
use yazi_shared::data::Data;
|
||||
|
||||
use crate::{Actor, Ctx};
|
||||
|
|
@ -8,11 +8,11 @@ use crate::{Actor, Ctx};
|
|||
pub struct Show;
|
||||
|
||||
impl Actor for Show {
|
||||
type Options = ShowOpt;
|
||||
type Form = ShowForm;
|
||||
|
||||
const NAME: &str = "show";
|
||||
|
||||
fn act(cx: &mut Ctx, opt: Self::Options) -> Result<Data> {
|
||||
fn act(cx: &mut Ctx, opt: Self::Form) -> Result<Data> {
|
||||
act!(confirm:close, cx)?;
|
||||
|
||||
let confirm = &mut cx.confirm;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use anyhow::Result;
|
||||
use yazi_macro::{render, succ};
|
||||
use yazi_parser::ArrowOpt;
|
||||
use yazi_parser::ArrowForm;
|
||||
use yazi_shared::data::Data;
|
||||
use yazi_widgets::Scrollable;
|
||||
|
||||
|
|
@ -9,11 +9,11 @@ use crate::{Actor, Ctx};
|
|||
pub struct Arrow;
|
||||
|
||||
impl Actor for Arrow {
|
||||
type Options = ArrowOpt;
|
||||
type Form = ArrowForm;
|
||||
|
||||
const NAME: &str = "arrow";
|
||||
|
||||
fn act(cx: &mut Ctx, opt: Self::Options) -> Result<Data> {
|
||||
fn act(cx: &mut Ctx, opt: Self::Form) -> Result<Data> {
|
||||
succ!(render!(cx.help.scroll(opt.step)));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use anyhow::Result;
|
||||
use yazi_macro::{act, render, succ};
|
||||
use yazi_parser::VoidOpt;
|
||||
use yazi_parser::VoidForm;
|
||||
use yazi_shared::data::Data;
|
||||
|
||||
use crate::{Actor, Ctx};
|
||||
|
|
@ -8,11 +8,11 @@ use crate::{Actor, Ctx};
|
|||
pub struct Escape;
|
||||
|
||||
impl Actor for Escape {
|
||||
type Options = VoidOpt;
|
||||
type Form = VoidForm;
|
||||
|
||||
const NAME: &str = "escape";
|
||||
|
||||
fn act(cx: &mut Ctx, _: Self::Options) -> Result<Data> {
|
||||
fn act(cx: &mut Ctx, _: Self::Form) -> Result<Data> {
|
||||
if cx.help.keyword().is_none() {
|
||||
return act!(help:toggle, cx, cx.help.layer);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use anyhow::Result;
|
||||
use yazi_macro::{render, succ};
|
||||
use yazi_parser::VoidOpt;
|
||||
use yazi_parser::VoidForm;
|
||||
use yazi_shared::data::Data;
|
||||
|
||||
use crate::{Actor, Ctx};
|
||||
|
|
@ -8,11 +8,11 @@ use crate::{Actor, Ctx};
|
|||
pub struct Filter;
|
||||
|
||||
impl Actor for Filter {
|
||||
type Options = VoidOpt;
|
||||
type Form = VoidForm;
|
||||
|
||||
const NAME: &str = "filter";
|
||||
|
||||
fn act(cx: &mut Ctx, _: Self::Options) -> Result<Data> {
|
||||
fn act(cx: &mut Ctx, _: Self::Form) -> Result<Data> {
|
||||
let help = &mut cx.help;
|
||||
|
||||
help.in_filter = Some(Default::default());
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use anyhow::Result;
|
||||
use yazi_macro::{render, succ};
|
||||
use yazi_parser::help::ToggleOpt;
|
||||
use yazi_parser::help::ToggleForm;
|
||||
use yazi_shared::data::Data;
|
||||
|
||||
use crate::{Actor, Ctx};
|
||||
|
|
@ -8,11 +8,11 @@ use crate::{Actor, Ctx};
|
|||
pub struct Toggle;
|
||||
|
||||
impl Actor for Toggle {
|
||||
type Options = ToggleOpt;
|
||||
type Form = ToggleForm;
|
||||
|
||||
const NAME: &str = "toggle";
|
||||
|
||||
fn act(cx: &mut Ctx, opt: Self::Options) -> Result<Data> {
|
||||
fn act(cx: &mut Ctx, opt: Self::Form) -> Result<Data> {
|
||||
let help = &mut cx.help;
|
||||
|
||||
help.visible = !help.visible;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use anyhow::Result;
|
||||
use yazi_macro::{act, render, succ};
|
||||
use yazi_parser::input::CloseOpt;
|
||||
use yazi_parser::input::CloseForm;
|
||||
use yazi_shared::data::Data;
|
||||
use yazi_widgets::input::InputEvent;
|
||||
|
||||
|
|
@ -9,11 +9,11 @@ use crate::{Actor, Ctx};
|
|||
pub struct Close;
|
||||
|
||||
impl Actor for Close {
|
||||
type Options = CloseOpt;
|
||||
type Form = CloseForm;
|
||||
|
||||
const NAME: &str = "close";
|
||||
|
||||
fn act(cx: &mut Ctx, opt: Self::Options) -> Result<Data> {
|
||||
fn act(cx: &mut Ctx, opt: Self::Form) -> Result<Data> {
|
||||
let input = &mut cx.input;
|
||||
input.visible = false;
|
||||
input.ticket.next();
|
||||
|
|
|
|||
|
|
@ -8,11 +8,11 @@ use crate::{Actor, Ctx};
|
|||
pub struct Complete;
|
||||
|
||||
impl Actor for Complete {
|
||||
type Options = CompleteOpt;
|
||||
type Form = CompleteOpt;
|
||||
|
||||
const NAME: &str = "complete";
|
||||
|
||||
fn act(cx: &mut Ctx, opt: Self::Options) -> Result<Data> {
|
||||
fn act(cx: &mut Ctx, opt: Self::Form) -> Result<Data> {
|
||||
let input = &mut cx.input;
|
||||
if !input.visible || input.ticket.current() != opt.ticket {
|
||||
succ!();
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use anyhow::Result;
|
||||
use yazi_macro::{act, render, succ};
|
||||
use yazi_parser::VoidOpt;
|
||||
use yazi_parser::VoidForm;
|
||||
use yazi_shared::data::Data;
|
||||
use yazi_widgets::input::InputOp;
|
||||
|
||||
|
|
@ -9,11 +9,11 @@ use crate::{Actor, Ctx};
|
|||
pub struct Escape;
|
||||
|
||||
impl Actor for Escape {
|
||||
type Options = VoidOpt;
|
||||
type Form = VoidForm;
|
||||
|
||||
const NAME: &str = "escape";
|
||||
|
||||
fn act(cx: &mut Ctx, _: Self::Options) -> Result<Data> {
|
||||
fn act(cx: &mut Ctx, _: Self::Form) -> Result<Data> {
|
||||
use yazi_widgets::input::InputMode as M;
|
||||
let input = &mut cx.input;
|
||||
|
||||
|
|
|
|||
|
|
@ -10,11 +10,11 @@ use crate::{Actor, Ctx};
|
|||
pub struct Show;
|
||||
|
||||
impl Actor for Show {
|
||||
type Options = InputOpt;
|
||||
type Form = InputOpt;
|
||||
|
||||
const NAME: &str = "show";
|
||||
|
||||
fn act(cx: &mut Ctx, opt: Self::Options) -> Result<Data> {
|
||||
fn act(cx: &mut Ctx, opt: Self::Form) -> Result<Data> {
|
||||
act!(input:close, cx)?;
|
||||
|
||||
let input = &mut cx.input;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use anyhow::Result;
|
||||
use yazi_macro::{act, render, succ};
|
||||
use yazi_parser::ArrowOpt;
|
||||
use yazi_parser::ArrowForm;
|
||||
use yazi_shared::data::Data;
|
||||
|
||||
use crate::{Actor, Ctx};
|
||||
|
|
@ -8,11 +8,11 @@ use crate::{Actor, Ctx};
|
|||
pub struct Arrow;
|
||||
|
||||
impl Actor for Arrow {
|
||||
type Options = ArrowOpt;
|
||||
type Form = ArrowForm;
|
||||
|
||||
const NAME: &str = "arrow";
|
||||
|
||||
fn act(cx: &mut Ctx, opt: Self::Options) -> Result<Data> {
|
||||
fn act(cx: &mut Ctx, opt: Self::Form) -> Result<Data> {
|
||||
let tab = cx.tab_mut();
|
||||
if !tab.current.arrow(opt.step) {
|
||||
succ!();
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use anyhow::Result;
|
||||
use yazi_macro::{act, succ};
|
||||
use yazi_parser::{VoidOpt, mgr::CdSource};
|
||||
use yazi_parser::{VoidForm, mgr::CdSource};
|
||||
use yazi_shared::data::Data;
|
||||
|
||||
use crate::{Actor, Ctx};
|
||||
|
|
@ -8,11 +8,11 @@ use crate::{Actor, Ctx};
|
|||
pub struct Back;
|
||||
|
||||
impl Actor for Back {
|
||||
type Options = VoidOpt;
|
||||
type Form = VoidForm;
|
||||
|
||||
const NAME: &str = "back";
|
||||
|
||||
fn act(cx: &mut Ctx, _: Self::Options) -> Result<Data> {
|
||||
fn act(cx: &mut Ctx, _: Self::Form) -> Result<Data> {
|
||||
if let Some(u) = cx.tab_mut().backstack.shift_backward().cloned() {
|
||||
act!(mgr:cd, cx, (u, CdSource::Back))?;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use anyhow::Result;
|
||||
use yazi_macro::succ;
|
||||
use yazi_parser::mgr::BulkExitOpt;
|
||||
use yazi_parser::mgr::BulkExitForm;
|
||||
use yazi_shared::data::Data;
|
||||
|
||||
use crate::{Actor, Ctx};
|
||||
|
|
@ -8,11 +8,11 @@ use crate::{Actor, Ctx};
|
|||
pub struct BulkExit;
|
||||
|
||||
impl Actor for BulkExit {
|
||||
type Options = BulkExitOpt;
|
||||
type Form = BulkExitForm;
|
||||
|
||||
const NAME: &str = "bulk_exit";
|
||||
|
||||
fn act(cx: &mut Ctx, opt: Self::Options) -> Result<Data> {
|
||||
fn act(cx: &mut Ctx, opt: Self::Form) -> Result<Data> {
|
||||
cx.mgr.batcher.decide(opt.target, opt.accept);
|
||||
succ!();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ use yazi_config::{YAZI, opener::OpenerRule};
|
|||
use yazi_dds::Pubsub;
|
||||
use yazi_fs::{File, FilesOp, Splatter, max_common_root, path::skip_url, provider::{FileBuilder, Provider, local::{Gate, Local}}};
|
||||
use yazi_macro::{err, succ};
|
||||
use yazi_parser::VoidOpt;
|
||||
use yazi_parser::VoidForm;
|
||||
use yazi_proxy::TasksProxy;
|
||||
use yazi_scheduler::{AppProxy, NotifyProxy};
|
||||
use yazi_shared::{data::Data, path::PathDyn, strand::{AsStrand, AsStrandJoin, Strand, StrandBuf, StrandLike}, terminal_clear, url::{AsUrl, UrlBuf, UrlCow, UrlLike}};
|
||||
|
|
@ -24,11 +24,11 @@ use crate::{Actor, Ctx};
|
|||
pub struct BulkRename;
|
||||
|
||||
impl Actor for BulkRename {
|
||||
type Options = VoidOpt;
|
||||
type Form = VoidForm;
|
||||
|
||||
const NAME: &str = "bulk_rename";
|
||||
|
||||
fn act(cx: &mut Ctx, _: Self::Options) -> Result<Data> {
|
||||
fn act(cx: &mut Ctx, _: Self::Form) -> Result<Data> {
|
||||
let Some(opener) = Self::opener() else {
|
||||
succ!(NotifyProxy::push_warn("Bulk rename", "No text opener found"));
|
||||
};
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ use yazi_config::popup::InputCfg;
|
|||
use yazi_dds::Pubsub;
|
||||
use yazi_fs::{File, FilesOp, path::{clean_url, expand_url}};
|
||||
use yazi_macro::{act, err, render, succ};
|
||||
use yazi_parser::mgr::CdOpt;
|
||||
use yazi_parser::mgr::CdForm;
|
||||
use yazi_proxy::{CmpProxy, InputProxy, MgrProxy};
|
||||
use yazi_shared::{Debounce, data::Data, url::{AsUrl, UrlBuf, UrlLike}};
|
||||
use yazi_vfs::{VfsFile, provider};
|
||||
|
|
@ -18,11 +18,11 @@ use crate::{Actor, Ctx};
|
|||
pub struct Cd;
|
||||
|
||||
impl Actor for Cd {
|
||||
type Options = CdOpt;
|
||||
type Form = CdForm;
|
||||
|
||||
const NAME: &str = "cd";
|
||||
|
||||
fn act(cx: &mut Ctx, opt: Self::Options) -> Result<Data> {
|
||||
fn act(cx: &mut Ctx, opt: Self::Form) -> Result<Data> {
|
||||
act!(mgr:escape_visual, cx)?;
|
||||
if opt.interactive {
|
||||
return Self::cd_interactive(cx);
|
||||
|
|
|
|||
|
|
@ -8,11 +8,11 @@ use crate::{Actor, Ctx};
|
|||
pub struct Close;
|
||||
|
||||
impl Actor for Close {
|
||||
type Options = CloseForm;
|
||||
type Form = CloseForm;
|
||||
|
||||
const NAME: &str = "close";
|
||||
|
||||
fn act(cx: &mut Ctx, Self::Options { opt }: Self::Options) -> Result<Data> {
|
||||
fn act(cx: &mut Ctx, Self::Form { opt }: Self::Form) -> Result<Data> {
|
||||
if cx.tabs().len() > 1 {
|
||||
act!(mgr:tab_close, cx, cx.tabs().cursor)
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use anyhow::{Result, bail};
|
||||
use yazi_macro::{act, succ};
|
||||
use yazi_parser::mgr::CopyOpt;
|
||||
use yazi_parser::mgr::CopyForm;
|
||||
use yazi_shared::{data::Data, strand::ToStrand, url::UrlLike};
|
||||
use yazi_widgets::CLIPBOARD;
|
||||
|
||||
|
|
@ -9,11 +9,11 @@ use crate::{Actor, Ctx};
|
|||
pub struct Copy;
|
||||
|
||||
impl Actor for Copy {
|
||||
type Options = CopyOpt;
|
||||
type Form = CopyForm;
|
||||
|
||||
const NAME: &str = "copy";
|
||||
|
||||
fn act(cx: &mut Ctx, opt: Self::Options) -> Result<Data> {
|
||||
fn act(cx: &mut Ctx, opt: Self::Form) -> Result<Data> {
|
||||
act!(mgr:escape_visual, cx)?;
|
||||
|
||||
let mut s = Vec::<u8>::new();
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ use anyhow::{Result, bail};
|
|||
use yazi_config::popup::{ConfirmCfg, InputCfg};
|
||||
use yazi_fs::{File, FilesOp};
|
||||
use yazi_macro::{ok_or_not_found, succ};
|
||||
use yazi_parser::mgr::CreateOpt;
|
||||
use yazi_parser::mgr::CreateForm;
|
||||
use yazi_proxy::{ConfirmProxy, InputProxy, MgrProxy};
|
||||
use yazi_shared::{data::Data, url::{UrlBuf, UrlLike}};
|
||||
use yazi_vfs::{VfsFile, maybe_exists, provider};
|
||||
|
|
@ -14,11 +14,11 @@ use crate::{Actor, Ctx};
|
|||
pub struct Create;
|
||||
|
||||
impl Actor for Create {
|
||||
type Options = CreateOpt;
|
||||
type Form = CreateForm;
|
||||
|
||||
const NAME: &str = "create";
|
||||
|
||||
fn act(cx: &mut Ctx, opt: Self::Options) -> Result<Data> {
|
||||
fn act(cx: &mut Ctx, opt: Self::Form) -> Result<Data> {
|
||||
let cwd = cx.cwd().to_owned();
|
||||
let mut input = InputProxy::show(InputCfg::create(opt.dir));
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
use anyhow::Result;
|
||||
use yazi_core::mgr::DisplaceOpt;
|
||||
use yazi_macro::succ;
|
||||
use yazi_parser::VoidOpt;
|
||||
use yazi_parser::VoidForm;
|
||||
use yazi_proxy::MgrProxy;
|
||||
use yazi_shared::{data::Data, url::UrlLike};
|
||||
use yazi_vfs::provider;
|
||||
|
|
@ -11,11 +11,11 @@ use crate::{Actor, Ctx};
|
|||
pub struct Displace;
|
||||
|
||||
impl Actor for Displace {
|
||||
type Options = VoidOpt;
|
||||
type Form = VoidForm;
|
||||
|
||||
const NAME: &str = "displace";
|
||||
|
||||
fn act(cx: &mut Ctx, _: Self::Options) -> Result<Data> {
|
||||
fn act(cx: &mut Ctx, _: Self::Form) -> Result<Data> {
|
||||
if cx.cwd().is_absolute() {
|
||||
succ!();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,11 +9,11 @@ use crate::{Actor, Ctx};
|
|||
pub struct DisplaceDo;
|
||||
|
||||
impl Actor for DisplaceDo {
|
||||
type Options = DisplaceDoForm;
|
||||
type Form = DisplaceDoForm;
|
||||
|
||||
const NAME: &str = "displace_do";
|
||||
|
||||
fn act(cx: &mut Ctx, Self::Options { opt }: Self::Options) -> Result<Data> {
|
||||
fn act(cx: &mut Ctx, Self::Form { opt }: Self::Form) -> Result<Data> {
|
||||
if cx.cwd() != opt.from {
|
||||
succ!()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ use hashbrown::HashSet;
|
|||
use yazi_core::mgr::OpenOpt;
|
||||
use yazi_fs::{File, FsScheme, provider::{Provider, local::Local}};
|
||||
use yazi_macro::succ;
|
||||
use yazi_parser::mgr::DownloadOpt;
|
||||
use yazi_parser::mgr::DownloadForm;
|
||||
use yazi_proxy::MgrProxy;
|
||||
use yazi_shared::{data::Data, url::{UrlCow, UrlLike}};
|
||||
use yazi_vfs::VfsFile;
|
||||
|
|
@ -16,11 +16,11 @@ use crate::{Actor, Ctx};
|
|||
pub struct Download;
|
||||
|
||||
impl Actor for Download {
|
||||
type Options = DownloadOpt;
|
||||
type Form = DownloadForm;
|
||||
|
||||
const NAME: &str = "download";
|
||||
|
||||
fn act(cx: &mut Ctx, opt: Self::Options) -> Result<Data> {
|
||||
fn act(cx: &mut Ctx, opt: Self::Form) -> Result<Data> {
|
||||
let cwd = cx.cwd().clone();
|
||||
let scheduler = cx.tasks.scheduler.clone();
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use anyhow::Result;
|
||||
use yazi_macro::{act, succ};
|
||||
use yazi_parser::{VoidOpt, mgr::CdSource};
|
||||
use yazi_parser::{VoidForm, mgr::CdSource};
|
||||
use yazi_shared::{data::Data, url::UrlLike};
|
||||
|
||||
use crate::{Actor, Ctx};
|
||||
|
|
@ -8,11 +8,11 @@ use crate::{Actor, Ctx};
|
|||
pub struct Enter;
|
||||
|
||||
impl Actor for Enter {
|
||||
type Options = VoidOpt;
|
||||
type Form = VoidForm;
|
||||
|
||||
const NAME: &str = "enter";
|
||||
|
||||
fn act(cx: &mut Ctx, _: Self::Options) -> Result<Data> {
|
||||
fn act(cx: &mut Ctx, _: Self::Form) -> 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() };
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use anyhow::{Result, bail};
|
||||
use yazi_macro::{act, render, render_and, succ};
|
||||
use yazi_parser::{VoidOpt, mgr::EscapeOpt};
|
||||
use yazi_parser::{VoidForm, mgr::EscapeForm};
|
||||
use yazi_scheduler::NotifyProxy;
|
||||
use yazi_shared::{data::Data, url::UrlLike};
|
||||
|
||||
|
|
@ -9,11 +9,11 @@ use crate::{Actor, Ctx};
|
|||
pub struct Escape;
|
||||
|
||||
impl Actor for Escape {
|
||||
type Options = EscapeOpt;
|
||||
type Form = EscapeForm;
|
||||
|
||||
const NAME: &str = "escape";
|
||||
|
||||
fn act(cx: &mut Ctx, opt: Self::Options) -> Result<Data> {
|
||||
fn act(cx: &mut Ctx, opt: Self::Form) -> Result<Data> {
|
||||
if opt.is_empty() {
|
||||
_ = act!(mgr:escape_find, cx)? != false
|
||||
|| act!(mgr:escape_visual, cx)? != false
|
||||
|
|
@ -23,19 +23,19 @@ impl Actor for Escape {
|
|||
succ!();
|
||||
}
|
||||
|
||||
if opt.contains(EscapeOpt::FIND) {
|
||||
if opt.contains(EscapeForm::FIND) {
|
||||
act!(mgr:escape_find, cx)?;
|
||||
}
|
||||
if opt.contains(EscapeOpt::VISUAL) {
|
||||
if opt.contains(EscapeForm::VISUAL) {
|
||||
act!(mgr:escape_visual, cx)?;
|
||||
}
|
||||
if opt.contains(EscapeOpt::FILTER) {
|
||||
if opt.contains(EscapeForm::FILTER) {
|
||||
act!(mgr:escape_filter, cx)?;
|
||||
}
|
||||
if opt.contains(EscapeOpt::SELECT) {
|
||||
if opt.contains(EscapeForm::SELECT) {
|
||||
act!(mgr:escape_select, cx)?;
|
||||
}
|
||||
if opt.contains(EscapeOpt::SEARCH) {
|
||||
if opt.contains(EscapeForm::SEARCH) {
|
||||
act!(mgr:escape_search, cx)?;
|
||||
}
|
||||
succ!();
|
||||
|
|
@ -46,11 +46,11 @@ impl Actor for Escape {
|
|||
pub struct EscapeFind;
|
||||
|
||||
impl Actor for EscapeFind {
|
||||
type Options = VoidOpt;
|
||||
type Form = VoidForm;
|
||||
|
||||
const NAME: &str = "escape_find";
|
||||
|
||||
fn act(cx: &mut Ctx, _: Self::Options) -> Result<Data> {
|
||||
fn act(cx: &mut Ctx, _: Self::Form) -> Result<Data> {
|
||||
succ!(render_and!(cx.tab_mut().finder.take().is_some()))
|
||||
}
|
||||
}
|
||||
|
|
@ -59,11 +59,11 @@ impl Actor for EscapeFind {
|
|||
pub struct EscapeVisual;
|
||||
|
||||
impl Actor for EscapeVisual {
|
||||
type Options = VoidOpt;
|
||||
type Form = VoidForm;
|
||||
|
||||
const NAME: &str = "escape_visual";
|
||||
|
||||
fn act(cx: &mut Ctx, _: Self::Options) -> Result<Data> {
|
||||
fn act(cx: &mut Ctx, _: Self::Form) -> Result<Data> {
|
||||
let tab = cx.tab_mut();
|
||||
|
||||
let select = tab.mode.is_select();
|
||||
|
|
@ -91,11 +91,11 @@ impl Actor for EscapeVisual {
|
|||
pub struct EscapeFilter;
|
||||
|
||||
impl Actor for EscapeFilter {
|
||||
type Options = VoidOpt;
|
||||
type Form = VoidForm;
|
||||
|
||||
const NAME: &str = "escape_filter";
|
||||
|
||||
fn act(cx: &mut Ctx, _: Self::Options) -> Result<Data> {
|
||||
fn act(cx: &mut Ctx, _: Self::Form) -> Result<Data> {
|
||||
if cx.current_mut().files.filter().is_none() {
|
||||
succ!(false);
|
||||
}
|
||||
|
|
@ -110,11 +110,11 @@ impl Actor for EscapeFilter {
|
|||
pub struct EscapeSelect;
|
||||
|
||||
impl Actor for EscapeSelect {
|
||||
type Options = VoidOpt;
|
||||
type Form = VoidForm;
|
||||
|
||||
const NAME: &str = "escape_select";
|
||||
|
||||
fn act(cx: &mut Ctx, _: Self::Options) -> Result<Data> {
|
||||
fn act(cx: &mut Ctx, _: Self::Form) -> Result<Data> {
|
||||
let tab = cx.tab_mut();
|
||||
if tab.selected.is_empty() {
|
||||
succ!(false);
|
||||
|
|
@ -134,11 +134,11 @@ impl Actor for EscapeSelect {
|
|||
pub struct EscapeSearch;
|
||||
|
||||
impl Actor for EscapeSearch {
|
||||
type Options = VoidOpt;
|
||||
type Form = VoidForm;
|
||||
|
||||
const NAME: &str = "escape_search";
|
||||
|
||||
fn act(cx: &mut Ctx, _: Self::Options) -> Result<Data> {
|
||||
fn act(cx: &mut Ctx, _: Self::Form) -> Result<Data> {
|
||||
let b = cx.cwd().is_search();
|
||||
act!(mgr:search_stop, cx)?;
|
||||
succ!(render_and!(b));
|
||||
|
|
|
|||
|
|
@ -16,11 +16,11 @@ use crate::{Actor, Ctx};
|
|||
pub struct Filter;
|
||||
|
||||
impl Actor for Filter {
|
||||
type Options = FilterForm;
|
||||
type Form = FilterForm;
|
||||
|
||||
const NAME: &str = "filter";
|
||||
|
||||
fn act(_: &mut Ctx, Self::Options { opt }: Self::Options) -> Result<Data> {
|
||||
fn act(_: &mut Ctx, Self::Form { opt }: Self::Form) -> Result<Data> {
|
||||
let input = InputProxy::show(InputCfg::filter());
|
||||
|
||||
tokio::spawn(async move {
|
||||
|
|
|
|||
|
|
@ -9,11 +9,11 @@ use crate::{Actor, Ctx};
|
|||
pub struct FilterDo;
|
||||
|
||||
impl Actor for FilterDo {
|
||||
type Options = FilterForm;
|
||||
type Form = FilterForm;
|
||||
|
||||
const NAME: &str = "filter_do";
|
||||
|
||||
fn act(cx: &mut Ctx, Self::Options { opt }: Self::Options) -> Result<Data> {
|
||||
fn act(cx: &mut Ctx, Self::Form { opt }: Self::Form) -> Result<Data> {
|
||||
let filter = if opt.query.is_empty() { None } else { Some(Filter::new(&opt.query, opt.case)?) };
|
||||
|
||||
let hovered = cx.hovered().map(|f| f.urn().into());
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ use tokio_stream::{StreamExt, wrappers::UnboundedReceiverStream};
|
|||
use yazi_config::popup::InputCfg;
|
||||
use yazi_core::mgr::FindDoOpt;
|
||||
use yazi_macro::succ;
|
||||
use yazi_parser::mgr::FindOpt;
|
||||
use yazi_parser::mgr::FindForm;
|
||||
use yazi_proxy::{InputProxy, MgrProxy};
|
||||
use yazi_shared::{Debounce, data::Data};
|
||||
use yazi_widgets::input::InputEvent;
|
||||
|
|
@ -16,11 +16,11 @@ use crate::{Actor, Ctx};
|
|||
pub struct Find;
|
||||
|
||||
impl Actor for Find {
|
||||
type Options = FindOpt;
|
||||
type Form = FindForm;
|
||||
|
||||
const NAME: &str = "find";
|
||||
|
||||
fn act(_: &mut Ctx, opt: Self::Options) -> Result<Data> {
|
||||
fn act(_: &mut Ctx, opt: Self::Form) -> Result<Data> {
|
||||
let input = InputProxy::show(InputCfg::find(opt.prev));
|
||||
|
||||
tokio::spawn(async move {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use anyhow::Result;
|
||||
use yazi_macro::{act, render, succ};
|
||||
use yazi_parser::mgr::FindArrowOpt;
|
||||
use yazi_parser::mgr::FindArrowForm;
|
||||
use yazi_shared::data::Data;
|
||||
|
||||
use crate::{Actor, Ctx};
|
||||
|
|
@ -8,11 +8,11 @@ use crate::{Actor, Ctx};
|
|||
pub struct FindArrow;
|
||||
|
||||
impl Actor for FindArrow {
|
||||
type Options = FindArrowOpt;
|
||||
type Form = FindArrowForm;
|
||||
|
||||
const NAME: &str = "find_arrow";
|
||||
|
||||
fn act(cx: &mut Ctx, opt: Self::Options) -> Result<Data> {
|
||||
fn act(cx: &mut Ctx, opt: Self::Form) -> Result<Data> {
|
||||
let tab = cx.tab_mut();
|
||||
let Some(finder) = &mut tab.finder else { succ!() };
|
||||
|
||||
|
|
|
|||
|
|
@ -9,11 +9,11 @@ use crate::{Actor, Ctx};
|
|||
pub struct FindDo;
|
||||
|
||||
impl Actor for FindDo {
|
||||
type Options = FindDoForm;
|
||||
type Form = FindDoForm;
|
||||
|
||||
const NAME: &str = "find_do";
|
||||
|
||||
fn act(cx: &mut Ctx, Self::Options { opt }: Self::Options) -> Result<Data> {
|
||||
fn act(cx: &mut Ctx, Self::Form { opt }: Self::Form) -> Result<Data> {
|
||||
if opt.query.is_empty() {
|
||||
return act!(mgr:escape_find, cx);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
use anyhow::Result;
|
||||
use yazi_fs::path::clean_url;
|
||||
use yazi_macro::{act, succ};
|
||||
use yazi_parser::{VoidOpt, mgr::CdSource};
|
||||
use yazi_parser::{VoidForm, mgr::CdSource};
|
||||
use yazi_shared::{data::Data, url::UrlLike};
|
||||
|
||||
use crate::{Actor, Ctx};
|
||||
|
|
@ -9,11 +9,11 @@ use crate::{Actor, Ctx};
|
|||
pub struct Follow;
|
||||
|
||||
impl Actor for Follow {
|
||||
type Options = VoidOpt;
|
||||
type Form = VoidForm;
|
||||
|
||||
const NAME: &str = "follow";
|
||||
|
||||
fn act(cx: &mut Ctx, _: Self::Options) -> Result<Data> {
|
||||
fn act(cx: &mut Ctx, _: Self::Form) -> Result<Data> {
|
||||
let Some(file) = cx.hovered() else { succ!() };
|
||||
let Some(link_to) = &file.link_to else { succ!() };
|
||||
let Some(parent) = file.url.parent() else { succ!() };
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use anyhow::Result;
|
||||
use yazi_macro::{act, succ};
|
||||
use yazi_parser::{VoidOpt, mgr::CdSource};
|
||||
use yazi_parser::{VoidForm, mgr::CdSource};
|
||||
use yazi_shared::data::Data;
|
||||
|
||||
use crate::{Actor, Ctx};
|
||||
|
|
@ -8,11 +8,11 @@ use crate::{Actor, Ctx};
|
|||
pub struct Forward;
|
||||
|
||||
impl Actor for Forward {
|
||||
type Options = VoidOpt;
|
||||
type Form = VoidForm;
|
||||
|
||||
const NAME: &str = "forward";
|
||||
|
||||
fn act(cx: &mut Ctx, _: Self::Options) -> Result<Data> {
|
||||
fn act(cx: &mut Ctx, _: Self::Form) -> Result<Data> {
|
||||
if let Some(u) = cx.tab_mut().backstack.shift_forward().cloned() {
|
||||
act!(mgr:cd, cx, (u, CdSource::Forward))?;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use anyhow::Result;
|
||||
use yazi_macro::succ;
|
||||
use yazi_parser::mgr::HardlinkOpt;
|
||||
use yazi_parser::mgr::HardlinkForm;
|
||||
use yazi_shared::data::Data;
|
||||
|
||||
use crate::{Actor, Ctx};
|
||||
|
|
@ -8,11 +8,11 @@ use crate::{Actor, Ctx};
|
|||
pub struct Hardlink;
|
||||
|
||||
impl Actor for Hardlink {
|
||||
type Options = HardlinkOpt;
|
||||
type Form = HardlinkForm;
|
||||
|
||||
const NAME: &str = "hardlink";
|
||||
|
||||
fn act(cx: &mut Ctx, opt: Self::Options) -> Result<Data> {
|
||||
fn act(cx: &mut Ctx, opt: Self::Form) -> Result<Data> {
|
||||
let mgr = &mut cx.core.mgr;
|
||||
let tab = &mgr.tabs[cx.tab];
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ use anyhow::Result;
|
|||
use yazi_core::tab::Folder;
|
||||
use yazi_fs::FolderStage;
|
||||
use yazi_macro::{act, render, render_and, succ};
|
||||
use yazi_parser::{mgr::HiddenOpt, spark::SparkKind};
|
||||
use yazi_parser::{mgr::HiddenForm, spark::SparkKind};
|
||||
use yazi_shared::{Source, data::Data};
|
||||
|
||||
use crate::{Actor, Ctx};
|
||||
|
|
@ -10,11 +10,11 @@ use crate::{Actor, Ctx};
|
|||
pub struct Hidden;
|
||||
|
||||
impl Actor for Hidden {
|
||||
type Options = HiddenOpt;
|
||||
type Form = HiddenForm;
|
||||
|
||||
const NAME: &str = "hidden";
|
||||
|
||||
fn act(cx: &mut Ctx, opt: Self::Options) -> Result<Data> {
|
||||
fn act(cx: &mut Ctx, opt: Self::Form) -> Result<Data> {
|
||||
let state = opt.state.bool(cx.tab().pref.show_hidden);
|
||||
cx.tab_mut().pref.show_hidden = state;
|
||||
|
||||
|
|
@ -51,7 +51,7 @@ impl Actor for Hidden {
|
|||
succ!()
|
||||
}
|
||||
|
||||
fn hook(cx: &Ctx, _: &Self::Options) -> Option<SparkKind> {
|
||||
fn hook(cx: &Ctx, _: &Self::Form) -> Option<SparkKind> {
|
||||
match cx.source() {
|
||||
Source::Ind => Some(SparkKind::IndHidden),
|
||||
Source::Key => Some(SparkKind::KeyHidden),
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
use anyhow::Result;
|
||||
use yazi_dds::Pubsub;
|
||||
use yazi_macro::{err, render, succ, tab};
|
||||
use yazi_parser::mgr::HoverOpt;
|
||||
use yazi_parser::mgr::HoverForm;
|
||||
use yazi_shared::{data::Data, url::UrlLike};
|
||||
|
||||
use crate::{Actor, Ctx};
|
||||
|
|
@ -9,11 +9,11 @@ use crate::{Actor, Ctx};
|
|||
pub struct Hover;
|
||||
|
||||
impl Actor for Hover {
|
||||
type Options = HoverOpt;
|
||||
type Form = HoverForm;
|
||||
|
||||
const NAME: &str = "hover";
|
||||
|
||||
fn act(cx: &mut Ctx, opt: Self::Options) -> Result<Data> {
|
||||
fn act(cx: &mut Ctx, opt: Self::Form) -> Result<Data> {
|
||||
let tab = tab!(cx);
|
||||
|
||||
// Parent should always track CWD
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use anyhow::Result;
|
||||
use yazi_macro::{act, succ};
|
||||
use yazi_parser::{VoidOpt, mgr::CdSource};
|
||||
use yazi_parser::{VoidForm, mgr::CdSource};
|
||||
use yazi_shared::{data::Data, url::UrlLike};
|
||||
|
||||
use crate::{Actor, Ctx};
|
||||
|
|
@ -8,11 +8,11 @@ use crate::{Actor, Ctx};
|
|||
pub struct Leave;
|
||||
|
||||
impl Actor for Leave {
|
||||
type Options = VoidOpt;
|
||||
type Form = VoidForm;
|
||||
|
||||
const NAME: &str = "leave";
|
||||
|
||||
fn act(cx: &mut Ctx, _: Self::Options) -> Result<Data> {
|
||||
fn act(cx: &mut Ctx, _: Self::Form) -> Result<Data> {
|
||||
let url = cx
|
||||
.hovered()
|
||||
.and_then(|h| h.url.parent())
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use anyhow::Result;
|
||||
use yazi_macro::{render, succ};
|
||||
use yazi_parser::mgr::LinemodeOpt;
|
||||
use yazi_parser::mgr::LinemodeForm;
|
||||
use yazi_shared::data::Data;
|
||||
|
||||
use crate::{Actor, Ctx};
|
||||
|
|
@ -8,11 +8,11 @@ use crate::{Actor, Ctx};
|
|||
pub struct Linemode;
|
||||
|
||||
impl Actor for Linemode {
|
||||
type Options = LinemodeOpt;
|
||||
type Form = LinemodeForm;
|
||||
|
||||
const NAME: &str = "linemode";
|
||||
|
||||
fn act(cx: &mut Ctx, opt: Self::Options) -> Result<Data> {
|
||||
fn act(cx: &mut Ctx, opt: Self::Form) -> Result<Data> {
|
||||
let tab = cx.tab_mut();
|
||||
|
||||
if opt.new != tab.pref.linemode {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use anyhow::Result;
|
||||
use yazi_macro::succ;
|
||||
use yazi_parser::mgr::LinkOpt;
|
||||
use yazi_parser::mgr::LinkForm;
|
||||
use yazi_shared::data::Data;
|
||||
|
||||
use crate::{Actor, Ctx};
|
||||
|
|
@ -8,11 +8,11 @@ use crate::{Actor, Ctx};
|
|||
pub struct Link;
|
||||
|
||||
impl Actor for Link {
|
||||
type Options = LinkOpt;
|
||||
type Form = LinkForm;
|
||||
|
||||
const NAME: &str = "link";
|
||||
|
||||
fn act(cx: &mut Ctx, opt: Self::Options) -> Result<Data> {
|
||||
fn act(cx: &mut Ctx, opt: Self::Form) -> Result<Data> {
|
||||
let mgr = &mut cx.core.mgr;
|
||||
let tab = &mgr.tabs[cx.tab];
|
||||
|
||||
|
|
|
|||
|
|
@ -13,11 +13,11 @@ use crate::{Actor, Ctx, mgr::Quit};
|
|||
pub struct Open;
|
||||
|
||||
impl Actor for Open {
|
||||
type Options = OpenForm;
|
||||
type Form = OpenForm;
|
||||
|
||||
const NAME: &str = "open";
|
||||
|
||||
fn act(cx: &mut Ctx, Self::Options { mut opt }: Self::Options) -> Result<Data> {
|
||||
fn act(cx: &mut Ctx, Self::Form { mut opt }: Self::Form) -> Result<Data> {
|
||||
if !opt.interactive && ARGS.chooser_file.is_some() {
|
||||
succ!(if !opt.targets.is_empty() {
|
||||
Quit::with_selected(opt.targets)
|
||||
|
|
|
|||
|
|
@ -12,11 +12,11 @@ use crate::{Actor, Ctx};
|
|||
pub struct OpenDo;
|
||||
|
||||
impl Actor for OpenDo {
|
||||
type Options = OpenDoForm;
|
||||
type Form = OpenDoForm;
|
||||
|
||||
const NAME: &str = "open_do";
|
||||
|
||||
fn act(cx: &mut Ctx, Self::Options { opt }: Self::Options) -> Result<Data> {
|
||||
fn act(cx: &mut Ctx, Self::Form { opt }: Self::Form) -> Result<Data> {
|
||||
let targets: Vec<_> = opt
|
||||
.targets
|
||||
.into_iter()
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use anyhow::Result;
|
||||
use yazi_macro::{act, succ};
|
||||
use yazi_parser::mgr::PasteOpt;
|
||||
use yazi_parser::mgr::PasteForm;
|
||||
use yazi_shared::data::Data;
|
||||
|
||||
use crate::{Actor, Ctx};
|
||||
|
|
@ -8,11 +8,11 @@ use crate::{Actor, Ctx};
|
|||
pub struct Paste;
|
||||
|
||||
impl Actor for Paste {
|
||||
type Options = PasteOpt;
|
||||
type Form = PasteForm;
|
||||
|
||||
const NAME: &str = "paste";
|
||||
|
||||
fn act(cx: &mut Ctx, opt: Self::Options) -> Result<Data> {
|
||||
fn act(cx: &mut Ctx, opt: Self::Form) -> Result<Data> {
|
||||
let mgr = &mut cx.core.mgr;
|
||||
let tab = &mgr.tabs[cx.tab];
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use anyhow::Result;
|
||||
use yazi_macro::succ;
|
||||
use yazi_parser::mgr::PeekOpt;
|
||||
use yazi_parser::mgr::PeekForm;
|
||||
use yazi_shared::data::Data;
|
||||
|
||||
use crate::{Actor, Ctx};
|
||||
|
|
@ -8,11 +8,11 @@ use crate::{Actor, Ctx};
|
|||
pub struct Peek;
|
||||
|
||||
impl Actor for Peek {
|
||||
type Options = PeekOpt;
|
||||
type Form = PeekForm;
|
||||
|
||||
const NAME: &str = "peek";
|
||||
|
||||
fn act(cx: &mut Ctx, opt: Self::Options) -> Result<Data> {
|
||||
fn act(cx: &mut Ctx, opt: Self::Form) -> Result<Data> {
|
||||
let Some(hovered) = cx.hovered().cloned() else {
|
||||
succ!(cx.tab_mut().preview.reset());
|
||||
};
|
||||
|
|
|
|||
|
|
@ -14,11 +14,11 @@ use crate::{Actor, Ctx};
|
|||
pub struct Quit;
|
||||
|
||||
impl Actor for Quit {
|
||||
type Options = QuitForm;
|
||||
type Form = QuitForm;
|
||||
|
||||
const NAME: &str = "quit";
|
||||
|
||||
fn act(cx: &mut Ctx, Self::Options { opt }: Self::Options) -> Result<Data> {
|
||||
fn act(cx: &mut Ctx, Self::Form { opt }: Self::Form) -> Result<Data> {
|
||||
let ongoing = cx.tasks.scheduler.ongoing.clone();
|
||||
let (left, left_names) = {
|
||||
let ongoing = ongoing.lock();
|
||||
|
|
@ -58,7 +58,7 @@ impl Actor for Quit {
|
|||
succ!();
|
||||
}
|
||||
|
||||
fn hook(cx: &Ctx, _opt: &Self::Options) -> Option<SparkKind> {
|
||||
fn hook(cx: &Ctx, _opt: &Self::Form) -> Option<SparkKind> {
|
||||
Some(SparkKind::KeyQuit).filter(|_| cx.source().is_key())
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ use anyhow::Result;
|
|||
use yazi_core::tab::Folder;
|
||||
use yazi_fs::{CWD, Files, FilesOp, cha::Cha};
|
||||
use yazi_macro::{act, succ};
|
||||
use yazi_parser::VoidOpt;
|
||||
use yazi_parser::VoidForm;
|
||||
use yazi_shared::{data::Data, url::{UrlBuf, UrlLike}};
|
||||
use yazi_vfs::{VfsFiles, VfsFilesOp};
|
||||
use yazi_watcher::MgrProxy;
|
||||
|
|
@ -12,11 +12,11 @@ use crate::{Actor, Ctx};
|
|||
pub struct Refresh;
|
||||
|
||||
impl Actor for Refresh {
|
||||
type Options = VoidOpt;
|
||||
type Form = VoidForm;
|
||||
|
||||
const NAME: &str = "refresh";
|
||||
|
||||
fn act(cx: &mut Ctx, _: Self::Options) -> Result<Data> {
|
||||
fn act(cx: &mut Ctx, _: Self::Form) -> Result<Data> {
|
||||
CWD.set(cx.cwd(), Self::cwd_changed);
|
||||
|
||||
if let Some(p) = cx.parent() {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
use anyhow::Result;
|
||||
use yazi_config::popup::ConfirmCfg;
|
||||
use yazi_macro::{act, succ};
|
||||
use yazi_parser::mgr::RemoveOpt;
|
||||
use yazi_parser::mgr::RemoveForm;
|
||||
use yazi_proxy::{ConfirmProxy, MgrProxy};
|
||||
use yazi_shared::data::Data;
|
||||
|
||||
|
|
@ -10,11 +10,11 @@ use crate::{Actor, Ctx};
|
|||
pub struct Remove;
|
||||
|
||||
impl Actor for Remove {
|
||||
type Options = RemoveOpt;
|
||||
type Form = RemoveForm;
|
||||
|
||||
const NAME: &str = "remove";
|
||||
|
||||
fn act(cx: &mut Ctx, mut opt: Self::Options) -> Result<Data> {
|
||||
fn act(cx: &mut Ctx, mut opt: Self::Form) -> Result<Data> {
|
||||
act!(mgr:escape_visual, cx)?;
|
||||
|
||||
opt.targets = if opt.hovered {
|
||||
|
|
@ -48,11 +48,11 @@ impl Actor for Remove {
|
|||
pub struct RemoveDo;
|
||||
|
||||
impl Actor for RemoveDo {
|
||||
type Options = RemoveOpt;
|
||||
type Form = RemoveForm;
|
||||
|
||||
const NAME: &str = "remove_do";
|
||||
|
||||
fn act(cx: &mut Ctx, opt: Self::Options) -> Result<Data> {
|
||||
fn act(cx: &mut Ctx, opt: Self::Form) -> Result<Data> {
|
||||
let mgr = &mut cx.mgr;
|
||||
|
||||
mgr.tabs.iter_mut().for_each(|t| {
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ use yazi_config::popup::{ConfirmCfg, InputCfg};
|
|||
use yazi_dds::Pubsub;
|
||||
use yazi_fs::{File, FilesOp};
|
||||
use yazi_macro::{act, err, ok_or_not_found, succ};
|
||||
use yazi_parser::mgr::RenameOpt;
|
||||
use yazi_parser::mgr::RenameForm;
|
||||
use yazi_proxy::{ConfirmProxy, InputProxy, MgrProxy};
|
||||
use yazi_shared::{Id, data::Data, url::{UrlBuf, UrlLike}};
|
||||
use yazi_vfs::{VfsFile, maybe_exists, provider};
|
||||
|
|
@ -15,11 +15,11 @@ use crate::{Actor, Ctx};
|
|||
pub struct Rename;
|
||||
|
||||
impl Actor for Rename {
|
||||
type Options = RenameOpt;
|
||||
type Form = RenameForm;
|
||||
|
||||
const NAME: &str = "rename";
|
||||
|
||||
fn act(cx: &mut Ctx, opt: Self::Options) -> Result<Data> {
|
||||
fn act(cx: &mut Ctx, opt: Self::Form) -> Result<Data> {
|
||||
act!(mgr:escape_visual, cx)?;
|
||||
|
||||
if !opt.hovered && !cx.tab().selected.is_empty() {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
use anyhow::Result;
|
||||
use yazi_fs::{File, FilesOp};
|
||||
use yazi_macro::{act, render, succ};
|
||||
use yazi_parser::mgr::RevealOpt;
|
||||
use yazi_parser::mgr::RevealForm;
|
||||
use yazi_shared::{data::Data, url::UrlLike};
|
||||
|
||||
use crate::{Actor, Ctx};
|
||||
|
|
@ -9,11 +9,11 @@ use crate::{Actor, Ctx};
|
|||
pub struct Reveal;
|
||||
|
||||
impl Actor for Reveal {
|
||||
type Options = RevealOpt;
|
||||
type Form = RevealForm;
|
||||
|
||||
const NAME: &str = "reveal";
|
||||
|
||||
fn act(cx: &mut Ctx, opt: Self::Options) -> Result<Data> {
|
||||
fn act(cx: &mut Ctx, opt: Self::Form) -> Result<Data> {
|
||||
let Some((parent, child)) = opt.target.pair() else { succ!() };
|
||||
|
||||
// Cd to the parent directory
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ use yazi_config::popup::InputCfg;
|
|||
use yazi_core::mgr::SearchVia;
|
||||
use yazi_fs::{FilesOp, cha::Cha};
|
||||
use yazi_macro::{act, succ};
|
||||
use yazi_parser::{VoidOpt, mgr::{CdSource, SearchForm}};
|
||||
use yazi_parser::{VoidForm, mgr::{CdSource, SearchForm}};
|
||||
use yazi_plugin::external;
|
||||
use yazi_proxy::{InputProxy, MgrProxy};
|
||||
use yazi_scheduler::NotifyProxy;
|
||||
|
|
@ -19,11 +19,11 @@ use crate::{Actor, Ctx};
|
|||
pub struct Search;
|
||||
|
||||
impl Actor for Search {
|
||||
type Options = SearchForm;
|
||||
type Form = SearchForm;
|
||||
|
||||
const NAME: &str = "search";
|
||||
|
||||
fn act(cx: &mut Ctx, Self::Options { mut opt }: Self::Options) -> Result<Data> {
|
||||
fn act(cx: &mut Ctx, Self::Form { mut opt }: Self::Form) -> Result<Data> {
|
||||
if let Some(handle) = cx.tab_mut().search.take() {
|
||||
handle.abort();
|
||||
}
|
||||
|
|
@ -45,11 +45,11 @@ impl Actor for Search {
|
|||
pub struct SearchDo;
|
||||
|
||||
impl Actor for SearchDo {
|
||||
type Options = SearchForm;
|
||||
type Form = SearchForm;
|
||||
|
||||
const NAME: &str = "search_do";
|
||||
|
||||
fn act(cx: &mut Ctx, Self::Options { opt }: Self::Options) -> Result<Data> {
|
||||
fn act(cx: &mut Ctx, Self::Form { opt }: Self::Form) -> Result<Data> {
|
||||
let tab = cx.tab_mut();
|
||||
if let Some(handle) = tab.search.take() {
|
||||
handle.abort();
|
||||
|
|
@ -103,11 +103,11 @@ impl Actor for SearchDo {
|
|||
pub struct SearchStop;
|
||||
|
||||
impl Actor for SearchStop {
|
||||
type Options = VoidOpt;
|
||||
type Form = VoidForm;
|
||||
|
||||
const NAME: &str = "search_stop";
|
||||
|
||||
fn act(cx: &mut Ctx, _: Self::Options) -> Result<Data> {
|
||||
fn act(cx: &mut Ctx, _: Self::Form) -> Result<Data> {
|
||||
let tab = cx.tab_mut();
|
||||
if let Some(handle) = tab.search.take() {
|
||||
handle.abort();
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ use anyhow::Result;
|
|||
use mlua::ObjectLike;
|
||||
use yazi_config::YAZI;
|
||||
use yazi_macro::{act, succ};
|
||||
use yazi_parser::mgr::SeekOpt;
|
||||
use yazi_parser::mgr::SeekForm;
|
||||
use yazi_runner::{plugin::PluginOpt, previewer::SeekJob};
|
||||
use yazi_shared::data::Data;
|
||||
|
||||
|
|
@ -11,11 +11,11 @@ use crate::{Actor, Ctx};
|
|||
pub struct Seek;
|
||||
|
||||
impl Actor for Seek {
|
||||
type Options = SeekOpt;
|
||||
type Form = SeekForm;
|
||||
|
||||
const NAME: &str = "seek";
|
||||
|
||||
fn act(cx: &mut Ctx, opt: Self::Options) -> Result<Data> {
|
||||
fn act(cx: &mut Ctx, opt: Self::Form) -> Result<Data> {
|
||||
let Some(hovered) = cx.hovered() else {
|
||||
succ!(cx.tab_mut().preview.reset());
|
||||
};
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ use std::borrow::Cow;
|
|||
use anyhow::Result;
|
||||
use yazi_config::popup::InputCfg;
|
||||
use yazi_macro::{act, succ};
|
||||
use yazi_parser::mgr::ShellOpt;
|
||||
use yazi_parser::mgr::ShellForm;
|
||||
use yazi_proxy::{InputProxy, TasksProxy};
|
||||
use yazi_scheduler::process::ProcessOpt;
|
||||
use yazi_shared::data::Data;
|
||||
|
|
@ -14,11 +14,11 @@ use crate::{Actor, Ctx};
|
|||
pub struct Shell;
|
||||
|
||||
impl Actor for Shell {
|
||||
type Options = ShellOpt;
|
||||
type Form = ShellForm;
|
||||
|
||||
const NAME: &str = "shell";
|
||||
|
||||
fn act(cx: &mut Ctx, mut opt: Self::Options) -> Result<Data> {
|
||||
fn act(cx: &mut Ctx, mut opt: Self::Form) -> Result<Data> {
|
||||
act!(mgr:escape_visual, cx)?;
|
||||
|
||||
let cwd = opt.cwd.take().unwrap_or(cx.cwd().into()).into_owned();
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ use anyhow::Result;
|
|||
use yazi_core::tab::Folder;
|
||||
use yazi_fs::{FilesSorter, FolderStage};
|
||||
use yazi_macro::{act, render, render_and, succ};
|
||||
use yazi_parser::{mgr::SortOpt, spark::SparkKind};
|
||||
use yazi_parser::{mgr::SortForm, spark::SparkKind};
|
||||
use yazi_shared::{Source, data::Data};
|
||||
|
||||
use crate::{Actor, Ctx};
|
||||
|
|
@ -10,11 +10,11 @@ use crate::{Actor, Ctx};
|
|||
pub struct Sort;
|
||||
|
||||
impl Actor for Sort {
|
||||
type Options = SortOpt;
|
||||
type Form = SortForm;
|
||||
|
||||
const NAME: &str = "sort";
|
||||
|
||||
fn act(cx: &mut Ctx, opt: Self::Options) -> Result<Data> {
|
||||
fn act(cx: &mut Ctx, opt: Self::Form) -> Result<Data> {
|
||||
let pref = &mut cx.tab_mut().pref;
|
||||
pref.sort_by = opt.by.unwrap_or(pref.sort_by);
|
||||
pref.sort_reverse = opt.reverse.unwrap_or(pref.sort_reverse);
|
||||
|
|
@ -58,7 +58,7 @@ impl Actor for Sort {
|
|||
succ!();
|
||||
}
|
||||
|
||||
fn hook(cx: &Ctx, _: &Self::Options) -> Option<SparkKind> {
|
||||
fn hook(cx: &Ctx, _: &Self::Form) -> Option<SparkKind> {
|
||||
match cx.source() {
|
||||
Source::Ind => Some(SparkKind::IndSort),
|
||||
Source::Key => Some(SparkKind::KeySort),
|
||||
|
|
|
|||
|
|
@ -8,11 +8,11 @@ use crate::{Actor, Ctx};
|
|||
pub struct Spot;
|
||||
|
||||
impl Actor for Spot {
|
||||
type Options = SpotOpt;
|
||||
type Form = SpotOpt;
|
||||
|
||||
const NAME: &str = "spot";
|
||||
|
||||
fn act(cx: &mut Ctx, opt: Self::Options) -> Result<Data> {
|
||||
fn act(cx: &mut Ctx, opt: Self::Form) -> Result<Data> {
|
||||
act!(mgr:escape_visual, cx)?;
|
||||
let Some(hovered) = cx.hovered().cloned() else { succ!() };
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use anyhow::Result;
|
||||
use yazi_macro::succ;
|
||||
use yazi_parser::{mgr::StashOpt, spark::SparkKind};
|
||||
use yazi_parser::{mgr::StashForm, spark::SparkKind};
|
||||
use yazi_shared::{Source, data::Data, url::{AsUrl, UrlLike}};
|
||||
|
||||
use crate::{Actor, Ctx};
|
||||
|
|
@ -8,11 +8,11 @@ use crate::{Actor, Ctx};
|
|||
pub struct Stash;
|
||||
|
||||
impl Actor for Stash {
|
||||
type Options = StashOpt;
|
||||
type Form = StashForm;
|
||||
|
||||
const NAME: &str = "stash";
|
||||
|
||||
fn act(cx: &mut Ctx, opt: Self::Options) -> Result<Data> {
|
||||
fn act(cx: &mut Ctx, opt: Self::Form) -> Result<Data> {
|
||||
if opt.target.is_absolute() && opt.target.is_internal() {
|
||||
cx.tab_mut().backstack.push(opt.target.as_url());
|
||||
}
|
||||
|
|
@ -20,7 +20,7 @@ impl Actor for Stash {
|
|||
succ!()
|
||||
}
|
||||
|
||||
fn hook(cx: &Ctx, _opt: &Self::Options) -> Option<SparkKind> {
|
||||
fn hook(cx: &Ctx, _opt: &Self::Form) -> Option<SparkKind> {
|
||||
match cx.source() {
|
||||
Source::Ind => Some(SparkKind::IndStash),
|
||||
Source::Relay => Some(SparkKind::RelayStash),
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use anyhow::Result;
|
||||
use yazi_macro::succ;
|
||||
use yazi_parser::VoidOpt;
|
||||
use yazi_parser::VoidForm;
|
||||
use yazi_shared::data::Data;
|
||||
|
||||
use crate::{Actor, Ctx};
|
||||
|
|
@ -8,11 +8,11 @@ use crate::{Actor, Ctx};
|
|||
pub struct Suspend;
|
||||
|
||||
impl Actor for Suspend {
|
||||
type Options = VoidOpt;
|
||||
type Form = VoidForm;
|
||||
|
||||
const NAME: &str = "suspend";
|
||||
|
||||
fn act(_: &mut Ctx, _: Self::Options) -> Result<Data> {
|
||||
fn act(_: &mut Ctx, _: Self::Form) -> Result<Data> {
|
||||
#[cfg(unix)]
|
||||
if !yazi_shared::session_leader() {
|
||||
unsafe {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use anyhow::Result;
|
||||
use yazi_macro::{act, render, succ};
|
||||
use yazi_parser::mgr::TabCloseOpt;
|
||||
use yazi_parser::mgr::TabCloseForm;
|
||||
use yazi_shared::data::Data;
|
||||
|
||||
use crate::{Actor, Ctx};
|
||||
|
|
@ -8,11 +8,11 @@ use crate::{Actor, Ctx};
|
|||
pub struct TabClose;
|
||||
|
||||
impl Actor for TabClose {
|
||||
type Options = TabCloseOpt;
|
||||
type Form = TabCloseForm;
|
||||
|
||||
const NAME: &str = "tab_close";
|
||||
|
||||
fn act(cx: &mut Ctx, opt: Self::Options) -> Result<Data> {
|
||||
fn act(cx: &mut Ctx, opt: Self::Form) -> Result<Data> {
|
||||
let len = cx.tabs().len();
|
||||
if len < 2 || opt.idx >= len {
|
||||
succ!();
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
use anyhow::Result;
|
||||
use yazi_core::tab::Tab;
|
||||
use yazi_macro::{act, render, succ};
|
||||
use yazi_parser::mgr::{CdSource, TabCreateOpt};
|
||||
use yazi_parser::mgr::{CdSource, TabCreateForm};
|
||||
use yazi_scheduler::NotifyProxy;
|
||||
use yazi_shared::{data::Data, url::UrlLike};
|
||||
|
||||
|
|
@ -12,11 +12,11 @@ const MAX_TABS: usize = 9;
|
|||
pub struct TabCreate;
|
||||
|
||||
impl Actor for TabCreate {
|
||||
type Options = TabCreateOpt;
|
||||
type Form = TabCreateForm;
|
||||
|
||||
const NAME: &str = "tab_create";
|
||||
|
||||
fn act(cx: &mut Ctx, opt: Self::Options) -> Result<Data> {
|
||||
fn act(cx: &mut Ctx, opt: Self::Form) -> Result<Data> {
|
||||
if cx.tabs().len() >= MAX_TABS {
|
||||
succ!(NotifyProxy::push_warn(
|
||||
"Too many tabs",
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ use std::borrow::Cow;
|
|||
use anyhow::Result;
|
||||
use yazi_config::popup::InputCfg;
|
||||
use yazi_macro::{act, render, succ};
|
||||
use yazi_parser::mgr::TabRenameOpt;
|
||||
use yazi_parser::mgr::TabRenameForm;
|
||||
use yazi_proxy::{InputProxy, MgrProxy};
|
||||
use yazi_shared::data::Data;
|
||||
use yazi_widgets::input::InputEvent;
|
||||
|
|
@ -13,11 +13,11 @@ use crate::{Actor, Ctx};
|
|||
pub struct TabRename;
|
||||
|
||||
impl Actor for TabRename {
|
||||
type Options = TabRenameOpt;
|
||||
type Form = TabRenameForm;
|
||||
|
||||
const NAME: &str = "tab_rename";
|
||||
|
||||
fn act(cx: &mut Ctx, opt: Self::Options) -> Result<Data> {
|
||||
fn act(cx: &mut Ctx, opt: Self::Form) -> Result<Data> {
|
||||
let tab = cx.tab().id;
|
||||
let pref = &mut cx.tab_mut().pref;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
use anyhow::Result;
|
||||
use yazi_dds::Pubsub;
|
||||
use yazi_macro::{err, render, succ};
|
||||
use yazi_parser::ArrowOpt;
|
||||
use yazi_parser::ArrowForm;
|
||||
use yazi_shared::data::Data;
|
||||
|
||||
use crate::{Actor, Ctx};
|
||||
|
|
@ -9,11 +9,11 @@ use crate::{Actor, Ctx};
|
|||
pub struct TabSwap;
|
||||
|
||||
impl Actor for TabSwap {
|
||||
type Options = ArrowOpt;
|
||||
type Form = ArrowForm;
|
||||
|
||||
const NAME: &str = "tab_swap";
|
||||
|
||||
fn act(cx: &mut Ctx, opt: Self::Options) -> Result<Data> {
|
||||
fn act(cx: &mut Ctx, opt: Self::Form) -> Result<Data> {
|
||||
let tabs = cx.tabs_mut();
|
||||
|
||||
let new = opt.step.add(tabs.cursor, tabs.len(), 0);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use anyhow::Result;
|
||||
use yazi_macro::{act, render, succ};
|
||||
use yazi_parser::mgr::TabSwitchOpt;
|
||||
use yazi_parser::mgr::TabSwitchForm;
|
||||
use yazi_shared::data::Data;
|
||||
|
||||
use crate::{Actor, Ctx};
|
||||
|
|
@ -8,11 +8,11 @@ use crate::{Actor, Ctx};
|
|||
pub struct TabSwitch;
|
||||
|
||||
impl Actor for TabSwitch {
|
||||
type Options = TabSwitchOpt;
|
||||
type Form = TabSwitchForm;
|
||||
|
||||
const NAME: &str = "tab_switch";
|
||||
|
||||
fn act(cx: &mut Ctx, opt: Self::Options) -> Result<Data> {
|
||||
fn act(cx: &mut Ctx, opt: Self::Form) -> Result<Data> {
|
||||
let tabs = cx.tabs_mut();
|
||||
let idx = if opt.relative {
|
||||
opt.step.saturating_add_unsigned(tabs.cursor).rem_euclid(tabs.len() as _) as _
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use anyhow::Result;
|
||||
use yazi_macro::{render_and, succ};
|
||||
use yazi_parser::mgr::ToggleOpt;
|
||||
use yazi_parser::mgr::ToggleForm;
|
||||
use yazi_scheduler::NotifyProxy;
|
||||
use yazi_shared::{data::Data, url::UrlCow};
|
||||
|
||||
|
|
@ -9,11 +9,11 @@ use crate::{Actor, Ctx};
|
|||
pub struct Toggle;
|
||||
|
||||
impl Actor for Toggle {
|
||||
type Options = ToggleOpt;
|
||||
type Form = ToggleForm;
|
||||
|
||||
const NAME: &str = "toggle";
|
||||
|
||||
fn act(cx: &mut Ctx, opt: Self::Options) -> Result<Data> {
|
||||
fn act(cx: &mut Ctx, opt: Self::Form) -> Result<Data> {
|
||||
let tab = cx.tab_mut();
|
||||
let Some(url) = opt.url.or(tab.current.hovered().map(|h| UrlCow::from(&h.url))) else {
|
||||
succ!();
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use anyhow::Result;
|
||||
use yazi_macro::{render, succ};
|
||||
use yazi_parser::mgr::ToggleAllOpt;
|
||||
use yazi_parser::mgr::ToggleAllForm;
|
||||
use yazi_scheduler::NotifyProxy;
|
||||
use yazi_shared::data::Data;
|
||||
|
||||
|
|
@ -9,11 +9,11 @@ use crate::{Actor, Ctx};
|
|||
pub struct ToggleAll;
|
||||
|
||||
impl Actor for ToggleAll {
|
||||
type Options = ToggleAllOpt;
|
||||
type Form = ToggleAllForm;
|
||||
|
||||
const NAME: &str = "toggle_all";
|
||||
|
||||
fn act(cx: &mut Ctx, opt: Self::Options) -> Result<Data> {
|
||||
fn act(cx: &mut Ctx, opt: Self::Form) -> Result<Data> {
|
||||
use either::Either::*;
|
||||
let tab = cx.tab_mut();
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use anyhow::Result;
|
||||
use yazi_macro::{act, render, succ};
|
||||
use yazi_parser::VoidOpt;
|
||||
use yazi_parser::VoidForm;
|
||||
use yazi_shared::data::Data;
|
||||
|
||||
use crate::{Actor, Ctx};
|
||||
|
|
@ -8,11 +8,11 @@ use crate::{Actor, Ctx};
|
|||
pub struct Unyank;
|
||||
|
||||
impl Actor for Unyank {
|
||||
type Options = VoidOpt;
|
||||
type Form = VoidForm;
|
||||
|
||||
const NAME: &str = "unyank";
|
||||
|
||||
fn act(cx: &mut Ctx, _: Self::Options) -> Result<Data> {
|
||||
fn act(cx: &mut Ctx, _: Self::Form) -> Result<Data> {
|
||||
let repeek = cx.hovered().is_some_and(|f| f.is_dir() && cx.mgr.yanked.contains_in(&f.url));
|
||||
cx.mgr.yanked.clear();
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ use anyhow::Result;
|
|||
use yazi_core::tab::Folder;
|
||||
use yazi_fs::FilesOp;
|
||||
use yazi_macro::{act, render, succ};
|
||||
use yazi_parser::mgr::UpdateFilesOpt;
|
||||
use yazi_parser::mgr::UpdateFilesForm;
|
||||
use yazi_shared::{data::Data, url::UrlLike};
|
||||
use yazi_watcher::local::LINKED;
|
||||
|
||||
|
|
@ -11,11 +11,11 @@ use crate::{Actor, Ctx};
|
|||
pub struct UpdateFiles;
|
||||
|
||||
impl Actor for UpdateFiles {
|
||||
type Options = UpdateFilesOpt;
|
||||
type Form = UpdateFilesForm;
|
||||
|
||||
const NAME: &str = "update_files";
|
||||
|
||||
fn act(cx: &mut Ctx, opt: Self::Options) -> Result<Data> {
|
||||
fn act(cx: &mut Ctx, opt: Self::Form) -> Result<Data> {
|
||||
let revision = cx.current().files.revision;
|
||||
let linked: Vec<_> = LINKED.read().from_dir(opt.op.cwd()).map(|u| opt.op.chdir(u)).collect();
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
use anyhow::Result;
|
||||
use hashbrown::HashMap;
|
||||
use yazi_macro::{act, render, succ};
|
||||
use yazi_parser::mgr::UpdateMimesOpt;
|
||||
use yazi_parser::mgr::UpdateMimesForm;
|
||||
use yazi_shared::{data::Data, pool::InternStr, url::{AsUrl, UrlCov}};
|
||||
use yazi_watcher::local::LINKED;
|
||||
|
||||
|
|
@ -10,11 +10,11 @@ use crate::{Actor, Ctx};
|
|||
pub struct UpdateMimes;
|
||||
|
||||
impl Actor for UpdateMimes {
|
||||
type Options = UpdateMimesOpt;
|
||||
type Form = UpdateMimesForm;
|
||||
|
||||
const NAME: &str = "update_mimes";
|
||||
|
||||
fn act(cx: &mut Ctx, opt: Self::Options) -> Result<Data> {
|
||||
fn act(cx: &mut Ctx, opt: Self::Form) -> Result<Data> {
|
||||
let linked = LINKED.read();
|
||||
let updates = opt
|
||||
.updates
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use anyhow::Result;
|
||||
use yazi_macro::succ;
|
||||
use yazi_parser::mgr::UpdatePagedOpt;
|
||||
use yazi_parser::mgr::UpdatePagedForm;
|
||||
use yazi_shared::data::Data;
|
||||
|
||||
use crate::{Actor, Ctx};
|
||||
|
|
@ -8,11 +8,11 @@ use crate::{Actor, Ctx};
|
|||
pub struct UpdatePaged;
|
||||
|
||||
impl Actor for UpdatePaged {
|
||||
type Options = UpdatePagedOpt;
|
||||
type Form = UpdatePagedForm;
|
||||
|
||||
const NAME: &str = "update_paged";
|
||||
|
||||
fn act(cx: &mut Ctx, opt: Self::Options) -> Result<Data> {
|
||||
fn act(cx: &mut Ctx, opt: Self::Form) -> Result<Data> {
|
||||
if opt.only_if.is_some_and(|u| u != *cx.cwd()) {
|
||||
succ!();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,11 +8,11 @@ use crate::{Actor, Ctx};
|
|||
pub struct UpdatePeeked;
|
||||
|
||||
impl Actor for UpdatePeeked {
|
||||
type Options = UpdatePeekedForm;
|
||||
type Form = UpdatePeekedForm;
|
||||
|
||||
const NAME: &str = "update_peeked";
|
||||
|
||||
fn act(cx: &mut Ctx, form: Self::Options) -> Result<Data> {
|
||||
fn act(cx: &mut Ctx, form: Self::Form) -> Result<Data> {
|
||||
let Some(hovered) = cx.hovered().map(|h| &h.url) else {
|
||||
succ!(cx.tab_mut().preview.reset());
|
||||
};
|
||||
|
|
|
|||
|
|
@ -8,11 +8,11 @@ use crate::{Actor, Ctx};
|
|||
pub struct UpdateSpotted;
|
||||
|
||||
impl Actor for UpdateSpotted {
|
||||
type Options = UpdateSpottedForm;
|
||||
type Form = UpdateSpottedForm;
|
||||
|
||||
const NAME: &str = "update_spotted";
|
||||
|
||||
fn act(cx: &mut Ctx, mut form: Self::Options) -> Result<Data> {
|
||||
fn act(cx: &mut Ctx, mut form: Self::Form) -> Result<Data> {
|
||||
let tab = cx.tab_mut();
|
||||
let Some(hovered) = tab.hovered().map(|h| &h.url) else {
|
||||
succ!(tab.spot.reset());
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
use anyhow::Result;
|
||||
use yazi_core::mgr::Yanked;
|
||||
use yazi_macro::{render, succ};
|
||||
use yazi_parser::mgr::UpdateYankedOpt;
|
||||
use yazi_parser::mgr::UpdateYankedForm;
|
||||
use yazi_shared::data::Data;
|
||||
|
||||
use crate::{Actor, Ctx};
|
||||
|
|
@ -9,11 +9,11 @@ use crate::{Actor, Ctx};
|
|||
pub struct UpdateYanked;
|
||||
|
||||
impl Actor for UpdateYanked {
|
||||
type Options = UpdateYankedOpt<'static>;
|
||||
type Form = UpdateYankedForm<'static>;
|
||||
|
||||
const NAME: &str = "update_yanked";
|
||||
|
||||
fn act(cx: &mut Ctx, opt: Self::Options) -> Result<Data> {
|
||||
fn act(cx: &mut Ctx, opt: Self::Form) -> Result<Data> {
|
||||
if opt.urls.is_empty() && cx.mgr.yanked.is_empty() {
|
||||
succ!();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use anyhow::Result;
|
||||
use yazi_macro::succ;
|
||||
use yazi_parser::mgr::UploadOpt;
|
||||
use yazi_parser::mgr::UploadForm;
|
||||
use yazi_shared::data::Data;
|
||||
|
||||
use crate::{Actor, Ctx};
|
||||
|
|
@ -8,11 +8,11 @@ use crate::{Actor, Ctx};
|
|||
pub struct Upload;
|
||||
|
||||
impl Actor for Upload {
|
||||
type Options = UploadOpt;
|
||||
type Form = UploadForm;
|
||||
|
||||
const NAME: &str = "upload";
|
||||
|
||||
fn act(cx: &mut Ctx, opt: Self::Options) -> Result<Data> {
|
||||
fn act(cx: &mut Ctx, opt: Self::Form) -> Result<Data> {
|
||||
for url in opt.urls {
|
||||
cx.tasks.scheduler.file_upload(url.into_owned());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ use std::collections::BTreeSet;
|
|||
use anyhow::Result;
|
||||
use yazi_core::tab::Mode;
|
||||
use yazi_macro::{render, succ};
|
||||
use yazi_parser::mgr::VisualModeOpt;
|
||||
use yazi_parser::mgr::VisualModeForm;
|
||||
use yazi_shared::data::Data;
|
||||
|
||||
use crate::{Actor, Ctx};
|
||||
|
|
@ -11,11 +11,11 @@ use crate::{Actor, Ctx};
|
|||
pub struct VisualMode;
|
||||
|
||||
impl Actor for VisualMode {
|
||||
type Options = VisualModeOpt;
|
||||
type Form = VisualModeForm;
|
||||
|
||||
const NAME: &str = "visual_mode";
|
||||
|
||||
fn act(cx: &mut Ctx, opt: Self::Options) -> Result<Data> {
|
||||
fn act(cx: &mut Ctx, opt: Self::Form) -> Result<Data> {
|
||||
let tab = cx.tab_mut();
|
||||
|
||||
let idx = tab.current.cursor;
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ use std::iter;
|
|||
|
||||
use anyhow::Result;
|
||||
use yazi_macro::succ;
|
||||
use yazi_parser::VoidOpt;
|
||||
use yazi_parser::VoidForm;
|
||||
use yazi_shared::data::Data;
|
||||
|
||||
use crate::{Actor, Ctx};
|
||||
|
|
@ -10,11 +10,11 @@ use crate::{Actor, Ctx};
|
|||
pub struct Watch;
|
||||
|
||||
impl Actor for Watch {
|
||||
type Options = VoidOpt;
|
||||
type Form = VoidForm;
|
||||
|
||||
const NAME: &str = "watch";
|
||||
|
||||
fn act(cx: &mut Ctx, _: Self::Options) -> Result<Data> {
|
||||
fn act(cx: &mut Ctx, _: Self::Form) -> Result<Data> {
|
||||
let it = iter::once(cx.core.mgr.tabs.active().cwd())
|
||||
.chain(cx.core.mgr.tabs.parent().map(|p| &p.url))
|
||||
.chain(cx.core.mgr.tabs.hovered().filter(|h| h.is_dir()).map(|h| &h.url));
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
use anyhow::Result;
|
||||
use yazi_core::mgr::Yanked;
|
||||
use yazi_macro::{act, render};
|
||||
use yazi_parser::mgr::YankOpt;
|
||||
use yazi_parser::mgr::YankForm;
|
||||
use yazi_shared::{data::Data, url::UrlBufCov};
|
||||
|
||||
use crate::{Actor, Ctx};
|
||||
|
|
@ -9,11 +9,11 @@ use crate::{Actor, Ctx};
|
|||
pub struct Yank;
|
||||
|
||||
impl Actor for Yank {
|
||||
type Options = YankOpt;
|
||||
type Form = YankForm;
|
||||
|
||||
const NAME: &str = "yank";
|
||||
|
||||
fn act(cx: &mut Ctx, opt: Self::Options) -> Result<Data> {
|
||||
fn act(cx: &mut Ctx, opt: Self::Form) -> Result<Data> {
|
||||
act!(mgr:escape_visual, cx)?;
|
||||
|
||||
cx.mgr.yanked =
|
||||
|
|
|
|||
|
|
@ -11,11 +11,11 @@ use crate::{Actor, Ctx};
|
|||
pub struct Push;
|
||||
|
||||
impl Actor for Push {
|
||||
type Options = PushForm;
|
||||
type Form = PushForm;
|
||||
|
||||
const NAME: &str = "push";
|
||||
|
||||
fn act(cx: &mut Ctx, form: Self::Options) -> Result<Data> {
|
||||
fn act(cx: &mut Ctx, form: Self::Form) -> Result<Data> {
|
||||
let instant = Instant::now();
|
||||
|
||||
let mut msg = Message::from(form.opt);
|
||||
|
|
@ -28,7 +28,7 @@ impl Actor for Push {
|
|||
succ!();
|
||||
}
|
||||
|
||||
fn hook(cx: &Ctx, _: &Self::Options) -> Option<SparkKind> {
|
||||
fn hook(cx: &Ctx, _: &Self::Form) -> Option<SparkKind> {
|
||||
match cx.source() {
|
||||
Source::Relay => Some(SparkKind::RelayNotifyPush),
|
||||
_ => None,
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ use ratatui::layout::Rect;
|
|||
use yazi_core::notify::Notify;
|
||||
use yazi_emulator::Dimension;
|
||||
use yazi_macro::{render, render_partial, succ};
|
||||
use yazi_parser::notify::TickOpt;
|
||||
use yazi_parser::notify::TickForm;
|
||||
use yazi_proxy::NotifyProxy;
|
||||
use yazi_shared::data::Data;
|
||||
|
||||
|
|
@ -14,11 +14,11 @@ use crate::{Actor, Ctx};
|
|||
pub struct Tick;
|
||||
|
||||
impl Actor for Tick {
|
||||
type Options = TickOpt;
|
||||
type Form = TickForm;
|
||||
|
||||
const NAME: &str = "tick";
|
||||
|
||||
fn act(cx: &mut Ctx, opt: Self::Options) -> Result<Data> {
|
||||
fn act(cx: &mut Ctx, opt: Self::Form) -> Result<Data> {
|
||||
cx.notify.ticker.take().map(|h| h.abort());
|
||||
|
||||
let Dimension { rows, columns, .. } = Dimension::available();
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use anyhow::Result;
|
||||
use yazi_macro::{render, succ};
|
||||
use yazi_parser::ArrowOpt;
|
||||
use yazi_parser::ArrowForm;
|
||||
use yazi_shared::data::Data;
|
||||
use yazi_widgets::Scrollable;
|
||||
|
||||
|
|
@ -9,11 +9,11 @@ use crate::{Actor, Ctx};
|
|||
pub struct Arrow;
|
||||
|
||||
impl Actor for Arrow {
|
||||
type Options = ArrowOpt;
|
||||
type Form = ArrowForm;
|
||||
|
||||
const NAME: &str = "arrow";
|
||||
|
||||
fn act(cx: &mut Ctx, opt: Self::Options) -> Result<Data> {
|
||||
fn act(cx: &mut Ctx, opt: Self::Form) -> Result<Data> {
|
||||
succ!(render!(cx.pick.scroll(opt.step)));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use anyhow::Result;
|
||||
use yazi_macro::{render, succ};
|
||||
use yazi_parser::pick::CloseOpt;
|
||||
use yazi_parser::pick::CloseForm;
|
||||
use yazi_shared::data::Data;
|
||||
|
||||
use crate::{Actor, Ctx};
|
||||
|
|
@ -8,11 +8,11 @@ use crate::{Actor, Ctx};
|
|||
pub struct Close;
|
||||
|
||||
impl Actor for Close {
|
||||
type Options = CloseOpt;
|
||||
type Form = CloseForm;
|
||||
|
||||
const NAME: &str = "close";
|
||||
|
||||
fn act(cx: &mut Ctx, opt: Self::Options) -> Result<Data> {
|
||||
fn act(cx: &mut Ctx, opt: Self::Form) -> Result<Data> {
|
||||
let pick = &mut cx.pick;
|
||||
if let Some(cb) = pick.callback.take() {
|
||||
_ = cb.send(if opt.submit { Some(pick.cursor) } else { None });
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use anyhow::Result;
|
||||
use yazi_macro::{act, render, succ};
|
||||
use yazi_parser::pick::ShowOpt;
|
||||
use yazi_parser::pick::ShowForm;
|
||||
use yazi_shared::data::Data;
|
||||
|
||||
use crate::{Actor, Ctx};
|
||||
|
|
@ -8,11 +8,11 @@ use crate::{Actor, Ctx};
|
|||
pub struct Show;
|
||||
|
||||
impl Actor for Show {
|
||||
type Options = ShowOpt;
|
||||
type Form = ShowForm;
|
||||
|
||||
const NAME: &str = "show";
|
||||
|
||||
fn act(cx: &mut Ctx, opt: Self::Options) -> Result<Data> {
|
||||
fn act(cx: &mut Ctx, opt: Self::Form) -> Result<Data> {
|
||||
act!(pick:close, cx)?;
|
||||
|
||||
let pick = &mut cx.pick;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use anyhow::Result;
|
||||
use yazi_macro::{act, render, succ};
|
||||
use yazi_parser::ArrowOpt;
|
||||
use yazi_parser::ArrowForm;
|
||||
use yazi_shared::data::Data;
|
||||
|
||||
use crate::{Actor, Ctx};
|
||||
|
|
@ -8,11 +8,11 @@ use crate::{Actor, Ctx};
|
|||
pub struct Arrow;
|
||||
|
||||
impl Actor for Arrow {
|
||||
type Options = ArrowOpt;
|
||||
type Form = ArrowForm;
|
||||
|
||||
const NAME: &str = "arrow";
|
||||
|
||||
fn act(cx: &mut Ctx, opt: Self::Options) -> Result<Data> {
|
||||
fn act(cx: &mut Ctx, opt: Self::Form) -> Result<Data> {
|
||||
let spot = &mut cx.tab_mut().spot;
|
||||
let Some(lock) = &mut spot.lock else { succ!() };
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use anyhow::Result;
|
||||
use yazi_macro::succ;
|
||||
use yazi_parser::VoidOpt;
|
||||
use yazi_parser::VoidForm;
|
||||
use yazi_shared::data::Data;
|
||||
|
||||
use crate::{Actor, Ctx};
|
||||
|
|
@ -8,11 +8,11 @@ use crate::{Actor, Ctx};
|
|||
pub struct Close;
|
||||
|
||||
impl Actor for Close {
|
||||
type Options = VoidOpt;
|
||||
type Form = VoidForm;
|
||||
|
||||
const NAME: &str = "close";
|
||||
|
||||
fn act(cx: &mut Ctx, _: Self::Options) -> Result<Data> {
|
||||
fn act(cx: &mut Ctx, _: Self::Form) -> Result<Data> {
|
||||
succ!(cx.tab_mut().spot.reset());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use anyhow::Result;
|
||||
use yazi_macro::succ;
|
||||
use yazi_parser::spot::CopyOpt;
|
||||
use yazi_parser::spot::CopyForm;
|
||||
use yazi_shared::data::Data;
|
||||
use yazi_widgets::CLIPBOARD;
|
||||
|
||||
|
|
@ -9,11 +9,11 @@ use crate::{Actor, Ctx};
|
|||
pub struct Copy;
|
||||
|
||||
impl Actor for Copy {
|
||||
type Options = CopyOpt;
|
||||
type Form = CopyForm;
|
||||
|
||||
const NAME: &str = "copy";
|
||||
|
||||
fn act(cx: &mut Ctx, opt: Self::Options) -> Result<Data> {
|
||||
fn act(cx: &mut Ctx, opt: Self::Form) -> Result<Data> {
|
||||
let spot = &cx.tab().spot;
|
||||
let Some(lock) = &spot.lock else { succ!() };
|
||||
let Some(table) = lock.table() else { succ!() };
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue