This commit is contained in:
sxyazi 2026-03-31 21:53:29 +08:00
parent 875a09929d
commit 20227bdb13
No known key found for this signature in database
111 changed files with 245 additions and 245 deletions

View file

@ -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 }
}

View file

@ -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";

View file

@ -10,11 +10,11 @@ use crate::Actor;
pub struct Bootstrap;
impl Actor for Bootstrap {
type Options = VoidForm;
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() {

View file

@ -9,11 +9,11 @@ use crate::{Actor, Ctx};
pub struct Deprecate;
impl Actor for Deprecate {
type Options = DeprecateForm;
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(),

View file

@ -9,9 +9,9 @@ use crate::Actor;
pub struct Focus;
impl Actor for Focus {
type Options = VoidForm;
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) }
}

View file

@ -11,11 +11,11 @@ use crate::{Actor, Ctx, lives::Lives};
pub struct Lua;
impl Actor for Lua {
type Options = LuaForm;
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()?))

View file

@ -15,11 +15,11 @@ use crate::{Actor, Ctx};
pub struct Mouse;
impl Actor for Mouse {
type Options = MouseForm;
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!() };

View file

@ -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;

View file

@ -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));

View file

@ -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();

View file

@ -13,11 +13,11 @@ use crate::{Actor, Ctx};
pub struct Reflow;
impl Actor for Reflow {
type Options = ReflowForm;
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();

View file

@ -9,11 +9,11 @@ use crate::Actor;
pub struct Resize;
impl Actor for Resize {
type Options = ReflowForm;
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);

View file

@ -9,11 +9,11 @@ use crate::{Actor, Ctx};
pub struct Resume;
impl Actor for Resume {
type Options = ResumeForm;
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()?);

View file

@ -8,11 +8,11 @@ use crate::{Actor, Ctx};
pub struct Stop;
impl Actor for Stop {
type Options = StopForm;
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`

View file

@ -12,11 +12,11 @@ use crate::Actor;
pub struct Title;
impl Actor for Title {
type Options = TitleForm;
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,

View file

@ -9,11 +9,11 @@ use crate::Actor;
pub struct UpdateProgress;
impl Actor for UpdateProgress {
type Options = UpdateProgressForm;
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;

View file

@ -9,11 +9,11 @@ use crate::{Actor, Ctx};
pub struct Arrow;
impl Actor for Arrow {
type Options = ArrowForm;
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)));
}
}

View file

@ -11,11 +11,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, 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 });

View file

@ -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!();

View file

@ -14,11 +14,11 @@ use crate::{Actor, Ctx};
pub struct Trigger;
impl Actor for Trigger {
type Options = TriggerForm;
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() {

View file

@ -8,11 +8,11 @@ use crate::{Actor, Ctx};
pub struct Arrow;
impl Actor for Arrow {
type Options = ArrowForm;
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);

View file

@ -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, 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!());

View file

@ -8,11 +8,11 @@ use crate::{Actor, Ctx};
pub struct Show;
impl Actor for Show {
type Options = ShowForm;
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;

View file

@ -9,11 +9,11 @@ use crate::{Actor, Ctx};
pub struct Arrow;
impl Actor for Arrow {
type Options = ArrowForm;
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)));
}
}

View file

@ -8,11 +8,11 @@ use crate::{Actor, Ctx};
pub struct Escape;
impl Actor for Escape {
type Options = VoidForm;
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);
}

View file

@ -8,11 +8,11 @@ use crate::{Actor, Ctx};
pub struct Filter;
impl Actor for Filter {
type Options = VoidForm;
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());

View file

@ -8,11 +8,11 @@ use crate::{Actor, Ctx};
pub struct Toggle;
impl Actor for Toggle {
type Options = ToggleForm;
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;

View file

@ -9,11 +9,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, 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();

View file

@ -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!();

View file

@ -9,11 +9,11 @@ use crate::{Actor, Ctx};
pub struct Escape;
impl Actor for Escape {
type Options = VoidForm;
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;

View file

@ -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;

View file

@ -8,11 +8,11 @@ use crate::{Actor, Ctx};
pub struct Arrow;
impl Actor for Arrow {
type Options = ArrowForm;
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!();

View file

@ -8,11 +8,11 @@ use crate::{Actor, Ctx};
pub struct Back;
impl Actor for Back {
type Options = VoidForm;
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))?;
}

View file

@ -8,11 +8,11 @@ use crate::{Actor, Ctx};
pub struct BulkExit;
impl Actor for BulkExit {
type Options = BulkExitForm;
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!();
}

View file

@ -24,11 +24,11 @@ use crate::{Actor, Ctx};
pub struct BulkRename;
impl Actor for BulkRename {
type Options = VoidForm;
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"));
};

View file

@ -18,11 +18,11 @@ use crate::{Actor, Ctx};
pub struct Cd;
impl Actor for Cd {
type Options = CdForm;
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);

View file

@ -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 {

View file

@ -9,11 +9,11 @@ use crate::{Actor, Ctx};
pub struct Copy;
impl Actor for Copy {
type Options = CopyForm;
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();

View file

@ -14,11 +14,11 @@ use crate::{Actor, Ctx};
pub struct Create;
impl Actor for Create {
type Options = CreateForm;
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));

View file

@ -11,11 +11,11 @@ use crate::{Actor, Ctx};
pub struct Displace;
impl Actor for Displace {
type Options = VoidForm;
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!();
}

View file

@ -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!()
}

View file

@ -16,11 +16,11 @@ use crate::{Actor, Ctx};
pub struct Download;
impl Actor for Download {
type Options = DownloadForm;
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();

View file

@ -8,11 +8,11 @@ use crate::{Actor, Ctx};
pub struct Enter;
impl Actor for Enter {
type Options = VoidForm;
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() };

View file

@ -9,11 +9,11 @@ use crate::{Actor, Ctx};
pub struct Escape;
impl Actor for Escape {
type Options = EscapeForm;
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
@ -46,11 +46,11 @@ impl Actor for Escape {
pub struct EscapeFind;
impl Actor for EscapeFind {
type Options = VoidForm;
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 = VoidForm;
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 = VoidForm;
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 = VoidForm;
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 = VoidForm;
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));

View file

@ -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 {

View file

@ -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());

View file

@ -16,11 +16,11 @@ use crate::{Actor, Ctx};
pub struct Find;
impl Actor for Find {
type Options = FindForm;
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 {

View file

@ -8,11 +8,11 @@ use crate::{Actor, Ctx};
pub struct FindArrow;
impl Actor for FindArrow {
type Options = FindArrowForm;
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!() };

View file

@ -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);
}

View file

@ -9,11 +9,11 @@ use crate::{Actor, Ctx};
pub struct Follow;
impl Actor for Follow {
type Options = VoidForm;
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!() };

View file

@ -8,11 +8,11 @@ use crate::{Actor, Ctx};
pub struct Forward;
impl Actor for Forward {
type Options = VoidForm;
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))?;
}

View file

@ -8,11 +8,11 @@ use crate::{Actor, Ctx};
pub struct Hardlink;
impl Actor for Hardlink {
type Options = HardlinkForm;
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];

View file

@ -10,11 +10,11 @@ use crate::{Actor, Ctx};
pub struct Hidden;
impl Actor for Hidden {
type Options = HiddenForm;
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),

View file

@ -9,11 +9,11 @@ use crate::{Actor, Ctx};
pub struct Hover;
impl Actor for Hover {
type Options = HoverForm;
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

View file

@ -8,11 +8,11 @@ use crate::{Actor, Ctx};
pub struct Leave;
impl Actor for Leave {
type Options = VoidForm;
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())

View file

@ -8,11 +8,11 @@ use crate::{Actor, Ctx};
pub struct Linemode;
impl Actor for Linemode {
type Options = LinemodeForm;
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 {

View file

@ -8,11 +8,11 @@ use crate::{Actor, Ctx};
pub struct Link;
impl Actor for Link {
type Options = LinkForm;
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];

View file

@ -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)

View file

@ -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()

View file

@ -8,11 +8,11 @@ use crate::{Actor, Ctx};
pub struct Paste;
impl Actor for Paste {
type Options = PasteForm;
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];

View file

@ -8,11 +8,11 @@ use crate::{Actor, Ctx};
pub struct Peek;
impl Actor for Peek {
type Options = PeekForm;
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());
};

View file

@ -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())
}
}

View file

@ -12,11 +12,11 @@ use crate::{Actor, Ctx};
pub struct Refresh;
impl Actor for Refresh {
type Options = VoidForm;
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() {

View file

@ -10,11 +10,11 @@ use crate::{Actor, Ctx};
pub struct Remove;
impl Actor for Remove {
type Options = RemoveForm;
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 = RemoveForm;
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| {

View file

@ -15,11 +15,11 @@ use crate::{Actor, Ctx};
pub struct Rename;
impl Actor for Rename {
type Options = RenameForm;
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() {

View file

@ -9,11 +9,11 @@ use crate::{Actor, Ctx};
pub struct Reveal;
impl Actor for Reveal {
type Options = RevealForm;
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

View file

@ -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 = VoidForm;
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();

View file

@ -11,11 +11,11 @@ use crate::{Actor, Ctx};
pub struct Seek;
impl Actor for Seek {
type Options = SeekForm;
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());
};

View file

@ -14,11 +14,11 @@ use crate::{Actor, Ctx};
pub struct Shell;
impl Actor for Shell {
type Options = ShellForm;
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();

View file

@ -10,11 +10,11 @@ use crate::{Actor, Ctx};
pub struct Sort;
impl Actor for Sort {
type Options = SortForm;
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),

View file

@ -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!() };

View file

@ -8,11 +8,11 @@ use crate::{Actor, Ctx};
pub struct Stash;
impl Actor for Stash {
type Options = StashForm;
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),

View file

@ -8,11 +8,11 @@ use crate::{Actor, Ctx};
pub struct Suspend;
impl Actor for Suspend {
type Options = VoidForm;
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 {

View file

@ -8,11 +8,11 @@ use crate::{Actor, Ctx};
pub struct TabClose;
impl Actor for TabClose {
type Options = TabCloseForm;
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!();

View file

@ -12,11 +12,11 @@ const MAX_TABS: usize = 9;
pub struct TabCreate;
impl Actor for TabCreate {
type Options = TabCreateForm;
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",

View file

@ -13,11 +13,11 @@ use crate::{Actor, Ctx};
pub struct TabRename;
impl Actor for TabRename {
type Options = TabRenameForm;
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;

View file

@ -9,11 +9,11 @@ use crate::{Actor, Ctx};
pub struct TabSwap;
impl Actor for TabSwap {
type Options = ArrowForm;
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);

View file

@ -8,11 +8,11 @@ use crate::{Actor, Ctx};
pub struct TabSwitch;
impl Actor for TabSwitch {
type Options = TabSwitchForm;
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 _

View file

@ -9,11 +9,11 @@ use crate::{Actor, Ctx};
pub struct Toggle;
impl Actor for Toggle {
type Options = ToggleForm;
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!();

View file

@ -9,11 +9,11 @@ use crate::{Actor, Ctx};
pub struct ToggleAll;
impl Actor for ToggleAll {
type Options = ToggleAllForm;
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();

View file

@ -8,11 +8,11 @@ use crate::{Actor, Ctx};
pub struct Unyank;
impl Actor for Unyank {
type Options = VoidForm;
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();

View file

@ -11,11 +11,11 @@ use crate::{Actor, Ctx};
pub struct UpdateFiles;
impl Actor for UpdateFiles {
type Options = UpdateFilesForm;
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();

View file

@ -10,11 +10,11 @@ use crate::{Actor, Ctx};
pub struct UpdateMimes;
impl Actor for UpdateMimes {
type Options = UpdateMimesForm;
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

View file

@ -8,11 +8,11 @@ use crate::{Actor, Ctx};
pub struct UpdatePaged;
impl Actor for UpdatePaged {
type Options = UpdatePagedForm;
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!();
}

View file

@ -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());
};

View file

@ -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());

View file

@ -9,11 +9,11 @@ use crate::{Actor, Ctx};
pub struct UpdateYanked;
impl Actor for UpdateYanked {
type Options = UpdateYankedForm<'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!();
}

View file

@ -8,11 +8,11 @@ use crate::{Actor, Ctx};
pub struct Upload;
impl Actor for Upload {
type Options = UploadForm;
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());
}

View file

@ -11,11 +11,11 @@ use crate::{Actor, Ctx};
pub struct VisualMode;
impl Actor for VisualMode {
type Options = VisualModeForm;
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;

View file

@ -10,11 +10,11 @@ use crate::{Actor, Ctx};
pub struct Watch;
impl Actor for Watch {
type Options = VoidForm;
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));

View file

@ -9,11 +9,11 @@ use crate::{Actor, Ctx};
pub struct Yank;
impl Actor for Yank {
type Options = YankForm;
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 =

View file

@ -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,

View file

@ -14,11 +14,11 @@ use crate::{Actor, Ctx};
pub struct Tick;
impl Actor for Tick {
type Options = TickForm;
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();

View file

@ -9,11 +9,11 @@ use crate::{Actor, Ctx};
pub struct Arrow;
impl Actor for Arrow {
type Options = ArrowForm;
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)));
}
}

View file

@ -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, 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 });

View file

@ -8,11 +8,11 @@ use crate::{Actor, Ctx};
pub struct Show;
impl Actor for Show {
type Options = ShowForm;
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;

View file

@ -8,11 +8,11 @@ use crate::{Actor, Ctx};
pub struct Arrow;
impl Actor for Arrow {
type Options = ArrowForm;
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!() };

View file

@ -8,11 +8,11 @@ use crate::{Actor, Ctx};
pub struct Close;
impl Actor for Close {
type Options = VoidForm;
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());
}
}

View file

@ -9,11 +9,11 @@ use crate::{Actor, Ctx};
pub struct Copy;
impl Actor for Copy {
type Options = CopyForm;
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!() };

View file

@ -8,11 +8,11 @@ use crate::{Actor, Ctx};
pub struct Swipe;
impl Actor for Swipe {
type Options = ArrowForm;
type Form = ArrowForm;
const NAME: &str = "swipe";
fn act(cx: &mut Ctx, opt: Self::Options) -> Result<Data> {
fn act(cx: &mut Ctx, opt: Self::Form) -> Result<Data> {
act!(mgr:arrow, cx, opt)?;
act!(mgr:spot, cx)
}

Some files were not shown because too many files have changed in this diff Show more