mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
perf: introduce copy-on-write for event system to eliminate all memory reallocations (#1962)
This commit is contained in:
parent
5e48df5126
commit
37292adfde
122 changed files with 532 additions and 448 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
use std::{borrow::Cow, collections::VecDeque, hash::{Hash, Hasher}, sync::OnceLock};
|
use std::{borrow::Cow, hash::{Hash, Hasher}, sync::OnceLock};
|
||||||
|
|
||||||
use regex::Regex;
|
use regex::Regex;
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
|
|
@ -53,7 +53,4 @@ impl Chord {
|
||||||
|| self.run().to_lowercase().contains(&s)
|
|| self.run().to_lowercase().contains(&s)
|
||||||
|| self.on().to_lowercase().contains(&s)
|
|| self.on().to_lowercase().contains(&s)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
|
||||||
pub fn to_seq(&self) -> VecDeque<Cmd> { self.run.iter().map(|c| c.shallow_clone()).collect() }
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
use std::{collections::VecDeque, ops::Deref};
|
use std::{collections::VecDeque, ops::Deref};
|
||||||
|
|
||||||
use yazi_shared::event::Cmd;
|
use yazi_shared::event::CmdCow;
|
||||||
|
|
||||||
use super::Chord;
|
use super::Chord;
|
||||||
|
|
||||||
|
|
@ -10,14 +10,14 @@ pub enum ChordCow {
|
||||||
Borrowed(&'static Chord),
|
Borrowed(&'static Chord),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<&'static Chord> for ChordCow {
|
|
||||||
fn from(c: &'static Chord) -> Self { Self::Borrowed(c) }
|
|
||||||
}
|
|
||||||
|
|
||||||
impl From<Chord> for ChordCow {
|
impl From<Chord> for ChordCow {
|
||||||
fn from(c: Chord) -> Self { Self::Owned(c) }
|
fn from(c: Chord) -> Self { Self::Owned(c) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl From<&'static Chord> for ChordCow {
|
||||||
|
fn from(c: &'static Chord) -> Self { Self::Borrowed(c) }
|
||||||
|
}
|
||||||
|
|
||||||
impl Deref for ChordCow {
|
impl Deref for ChordCow {
|
||||||
type Target = Chord;
|
type Target = Chord;
|
||||||
|
|
||||||
|
|
@ -34,10 +34,10 @@ impl Default for ChordCow {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ChordCow {
|
impl ChordCow {
|
||||||
pub fn into_seq(self) -> VecDeque<Cmd> {
|
pub fn into_seq(self) -> VecDeque<CmdCow> {
|
||||||
match self {
|
match self {
|
||||||
Self::Owned(c) => c.run.into(),
|
Self::Owned(c) => c.run.into_iter().map(|c| c.into()).collect(),
|
||||||
Self::Borrowed(c) => c.to_seq(),
|
Self::Borrowed(c) => c.run.iter().map(|c| c.into()).collect(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
use yazi_macro::render;
|
use yazi_macro::render;
|
||||||
use yazi_shared::event::{Cmd, Data};
|
use yazi_shared::event::{CmdCow, Data};
|
||||||
|
|
||||||
use crate::completion::Completion;
|
use crate::completion::Completion;
|
||||||
|
|
||||||
|
|
@ -7,8 +7,8 @@ struct Opt {
|
||||||
step: isize,
|
step: isize,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<Cmd> for Opt {
|
impl From<CmdCow> for Opt {
|
||||||
fn from(c: Cmd) -> Self { Self { step: c.first().and_then(Data::as_isize).unwrap_or(0) } }
|
fn from(c: CmdCow) -> Self { Self { step: c.first().and_then(Data::as_isize).unwrap_or(0) } }
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Completion {
|
impl Completion {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
use yazi_macro::render;
|
use yazi_macro::render;
|
||||||
use yazi_proxy::InputProxy;
|
use yazi_proxy::InputProxy;
|
||||||
use yazi_shared::event::Cmd;
|
use yazi_shared::event::CmdCow;
|
||||||
|
|
||||||
use crate::completion::Completion;
|
use crate::completion::Completion;
|
||||||
|
|
||||||
|
|
@ -8,8 +8,8 @@ struct Opt {
|
||||||
submit: bool,
|
submit: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<Cmd> for Opt {
|
impl From<CmdCow> for Opt {
|
||||||
fn from(c: Cmd) -> Self { Self { submit: c.bool("submit") } }
|
fn from(c: CmdCow) -> Self { Self { submit: c.bool("submit") } }
|
||||||
}
|
}
|
||||||
impl From<bool> for Opt {
|
impl From<bool> for Opt {
|
||||||
fn from(submit: bool) -> Self { Self { submit } }
|
fn from(submit: bool) -> Self { Self { submit } }
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
use std::{mem, ops::ControlFlow};
|
use std::{borrow::Cow, mem, ops::ControlFlow};
|
||||||
|
|
||||||
use yazi_macro::render;
|
use yazi_macro::render;
|
||||||
use yazi_shared::event::{Cmd, Data};
|
use yazi_shared::event::{Cmd, CmdCow, Data};
|
||||||
|
|
||||||
use crate::completion::Completion;
|
use crate::completion::Completion;
|
||||||
|
|
||||||
|
|
@ -9,13 +9,13 @@ const LIMIT: usize = 30;
|
||||||
|
|
||||||
struct Opt {
|
struct Opt {
|
||||||
cache: Vec<String>,
|
cache: Vec<String>,
|
||||||
cache_name: String,
|
cache_name: Cow<'static, str>,
|
||||||
word: String,
|
word: Cow<'static, str>,
|
||||||
ticket: usize,
|
ticket: usize,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<Cmd> for Opt {
|
impl From<CmdCow> for Opt {
|
||||||
fn from(mut c: Cmd) -> Self {
|
fn from(mut c: CmdCow) -> Self {
|
||||||
Self {
|
Self {
|
||||||
cache: c.take_any("cache").unwrap_or_default(),
|
cache: c.take_any("cache").unwrap_or_default(),
|
||||||
cache_name: c.take_str("cache-name").unwrap_or_default(),
|
cache_name: c.take_str("cache-name").unwrap_or_default(),
|
||||||
|
|
@ -25,6 +25,10 @@ impl From<Cmd> for Opt {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl From<Cmd> for Opt {
|
||||||
|
fn from(c: Cmd) -> Self { Self::from(CmdCow::from(c)) }
|
||||||
|
}
|
||||||
|
|
||||||
impl Completion {
|
impl Completion {
|
||||||
#[yazi_codegen::command]
|
#[yazi_codegen::command]
|
||||||
pub fn show(&mut self, opt: Opt) {
|
pub fn show(&mut self, opt: Opt) {
|
||||||
|
|
@ -33,9 +37,9 @@ impl Completion {
|
||||||
}
|
}
|
||||||
|
|
||||||
if !opt.cache.is_empty() {
|
if !opt.cache.is_empty() {
|
||||||
self.caches.insert(opt.cache_name.to_owned(), opt.cache);
|
self.caches.insert(opt.cache_name.as_ref().to_owned(), opt.cache);
|
||||||
}
|
}
|
||||||
let Some(cache) = self.caches.get(&opt.cache_name) else {
|
let Some(cache) = self.caches.get(opt.cache_name.as_ref()) else {
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ use std::{borrow::Cow, mem, path::{MAIN_SEPARATOR, MAIN_SEPARATOR_STR}};
|
||||||
|
|
||||||
use tokio::fs;
|
use tokio::fs;
|
||||||
use yazi_macro::{emit, render};
|
use yazi_macro::{emit, render};
|
||||||
use yazi_shared::{Layer, event::{Cmd, Data}};
|
use yazi_shared::{Layer, event::{Cmd, CmdCow, Data}};
|
||||||
|
|
||||||
use crate::completion::Completion;
|
use crate::completion::Completion;
|
||||||
|
|
||||||
|
|
@ -13,12 +13,12 @@ const SEPARATOR: [char; 2] = ['/', '\\'];
|
||||||
const SEPARATOR: char = std::path::MAIN_SEPARATOR;
|
const SEPARATOR: char = std::path::MAIN_SEPARATOR;
|
||||||
|
|
||||||
struct Opt {
|
struct Opt {
|
||||||
word: String,
|
word: Cow<'static, str>,
|
||||||
ticket: usize,
|
ticket: usize,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<Cmd> for Opt {
|
impl From<CmdCow> for Opt {
|
||||||
fn from(mut c: Cmd) -> Self {
|
fn from(mut c: CmdCow) -> Self {
|
||||||
Self {
|
Self {
|
||||||
word: c.take_first_str().unwrap_or_default(),
|
word: c.take_first_str().unwrap_or_default(),
|
||||||
ticket: c.get("ticket").and_then(Data::as_usize).unwrap_or(0),
|
ticket: c.get("ticket").and_then(Data::as_usize).unwrap_or(0),
|
||||||
|
|
@ -40,7 +40,7 @@ impl Completion {
|
||||||
|
|
||||||
if self.caches.contains_key(&parent) {
|
if self.caches.contains_key(&parent) {
|
||||||
return self.show(
|
return self.show(
|
||||||
Cmd::new("show").with("cache-name", parent).with("word", child).with("ticket", opt.ticket),
|
Cmd::default().with("cache-name", parent).with("word", child).with("ticket", opt.ticket),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
use yazi_macro::render;
|
use yazi_macro::render;
|
||||||
use yazi_shared::event::{Cmd, Data};
|
use yazi_shared::event::{CmdCow, Data};
|
||||||
|
|
||||||
use crate::{confirm::Confirm, manager::Manager};
|
use crate::{confirm::Confirm, manager::Manager};
|
||||||
|
|
||||||
|
|
@ -7,8 +7,8 @@ struct Opt {
|
||||||
step: isize,
|
step: isize,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<Cmd> for Opt {
|
impl From<CmdCow> for Opt {
|
||||||
fn from(c: Cmd) -> Self { Self { step: c.first().and_then(Data::as_isize).unwrap_or(0) } }
|
fn from(c: CmdCow) -> Self { Self { step: c.first().and_then(Data::as_isize).unwrap_or(0) } }
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Confirm {
|
impl Confirm {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
use yazi_macro::render;
|
use yazi_macro::render;
|
||||||
use yazi_shared::event::Cmd;
|
use yazi_shared::event::CmdCow;
|
||||||
|
|
||||||
use crate::confirm::Confirm;
|
use crate::confirm::Confirm;
|
||||||
|
|
||||||
|
|
@ -7,8 +7,8 @@ struct Opt {
|
||||||
submit: bool,
|
submit: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<Cmd> for Opt {
|
impl From<CmdCow> for Opt {
|
||||||
fn from(c: Cmd) -> Self { Self { submit: c.bool("submit") } }
|
fn from(c: CmdCow) -> Self { Self { submit: c.bool("submit") } }
|
||||||
}
|
}
|
||||||
impl From<bool> for Opt {
|
impl From<bool> for Opt {
|
||||||
fn from(submit: bool) -> Self { Self { submit } }
|
fn from(submit: bool) -> Self { Self { submit } }
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
use tokio::sync::oneshot;
|
use tokio::sync::oneshot;
|
||||||
use yazi_config::popup::ConfirmCfg;
|
use yazi_config::popup::ConfirmCfg;
|
||||||
use yazi_macro::render;
|
use yazi_macro::render;
|
||||||
use yazi_shared::event::Cmd;
|
use yazi_shared::event::CmdCow;
|
||||||
|
|
||||||
use crate::confirm::Confirm;
|
use crate::confirm::Confirm;
|
||||||
|
|
||||||
|
|
@ -10,10 +10,10 @@ pub struct Opt {
|
||||||
tx: oneshot::Sender<bool>,
|
tx: oneshot::Sender<bool>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl TryFrom<Cmd> for Opt {
|
impl TryFrom<CmdCow> for Opt {
|
||||||
type Error = ();
|
type Error = ();
|
||||||
|
|
||||||
fn try_from(mut c: Cmd) -> Result<Self, Self::Error> {
|
fn try_from(mut c: CmdCow) -> Result<Self, Self::Error> {
|
||||||
Ok(Self { cfg: c.take_any("cfg").ok_or(())?, tx: c.take_any("tx").ok_or(())? })
|
Ok(Self { cfg: c.take_any("cfg").ok_or(())?, tx: c.take_any("tx").ok_or(())? })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
use yazi_macro::render;
|
use yazi_macro::render;
|
||||||
use yazi_shared::event::{Cmd, Data};
|
use yazi_shared::event::{CmdCow, Data};
|
||||||
|
|
||||||
use crate::help::Help;
|
use crate::help::Help;
|
||||||
|
|
||||||
|
|
@ -7,8 +7,8 @@ struct Opt {
|
||||||
step: isize,
|
step: isize,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<Cmd> for Opt {
|
impl From<CmdCow> for Opt {
|
||||||
fn from(c: Cmd) -> Self { Self { step: c.first().and_then(Data::as_isize).unwrap_or(0) } }
|
fn from(c: CmdCow) -> Self { Self { step: c.first().and_then(Data::as_isize).unwrap_or(0) } }
|
||||||
}
|
}
|
||||||
impl From<isize> for Opt {
|
impl From<isize> for Opt {
|
||||||
fn from(step: isize) -> Self { Self { step } }
|
fn from(step: isize) -> Self { Self { step } }
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
use yazi_macro::render;
|
use yazi_macro::render;
|
||||||
use yazi_shared::event::Cmd;
|
use yazi_shared::event::CmdCow;
|
||||||
|
|
||||||
use crate::help::Help;
|
use crate::help::Help;
|
||||||
|
|
||||||
impl Help {
|
impl Help {
|
||||||
pub fn escape(&mut self, _: Cmd) {
|
pub fn escape(&mut self, _: CmdCow) {
|
||||||
if self.keyword().is_none() {
|
if self.keyword().is_none() {
|
||||||
return self.toggle(self.layer);
|
return self.toggle(self.layer);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
use yazi_config::popup::{Offset, Origin, Position};
|
use yazi_config::popup::{Offset, Origin, Position};
|
||||||
use yazi_macro::render;
|
use yazi_macro::render;
|
||||||
use yazi_shared::event::Cmd;
|
use yazi_shared::event::CmdCow;
|
||||||
|
|
||||||
use crate::{help::Help, input::Input};
|
use crate::{help::Help, input::Input};
|
||||||
|
|
||||||
impl Help {
|
impl Help {
|
||||||
pub fn filter(&mut self, _: Cmd) {
|
pub fn filter(&mut self, _: CmdCow) {
|
||||||
let mut input = Input::default();
|
let mut input = Input::default();
|
||||||
input.position = Position::new(Origin::BottomLeft, Offset::line());
|
input.position = Position::new(Origin::BottomLeft, Offset::line());
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
use yazi_macro::render;
|
use yazi_macro::render;
|
||||||
use yazi_shared::event::Cmd;
|
use yazi_shared::event::CmdCow;
|
||||||
|
|
||||||
use crate::input::Input;
|
use crate::input::Input;
|
||||||
|
|
||||||
|
|
@ -7,8 +7,8 @@ struct Opt {
|
||||||
under: bool,
|
under: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<Cmd> for Opt {
|
impl From<CmdCow> for Opt {
|
||||||
fn from(c: Cmd) -> Self { Self { under: c.bool("under") } }
|
fn from(c: CmdCow) -> Self { Self { under: c.bool("under") } }
|
||||||
}
|
}
|
||||||
impl From<bool> for Opt {
|
impl From<bool> for Opt {
|
||||||
fn from(under: bool) -> Self { Self { under } }
|
fn from(under: bool) -> Self { Self { under } }
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
use yazi_shared::{CharKind, event::Cmd};
|
use yazi_shared::{CharKind, event::CmdCow};
|
||||||
|
|
||||||
use crate::input::Input;
|
use crate::input::Input;
|
||||||
|
|
||||||
impl Input {
|
impl Input {
|
||||||
pub fn backward(&mut self, _: Cmd) {
|
pub fn backward(&mut self, _: CmdCow) {
|
||||||
let snap = self.snap();
|
let snap = self.snap();
|
||||||
if snap.cursor == 0 {
|
if snap.cursor == 0 {
|
||||||
return self.move_(0);
|
return self.move_(0);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
use yazi_macro::render;
|
use yazi_macro::render;
|
||||||
use yazi_proxy::CompletionProxy;
|
use yazi_proxy::CompletionProxy;
|
||||||
use yazi_shared::{errors::InputError, event::Cmd};
|
use yazi_shared::{errors::InputError, event::CmdCow};
|
||||||
|
|
||||||
use crate::input::Input;
|
use crate::input::Input;
|
||||||
|
|
||||||
|
|
@ -8,8 +8,8 @@ struct Opt {
|
||||||
submit: bool,
|
submit: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<Cmd> for Opt {
|
impl From<CmdCow> for Opt {
|
||||||
fn from(c: Cmd) -> Self { Self { submit: c.bool("submit") } }
|
fn from(c: CmdCow) -> Self { Self { submit: c.bool("submit") } }
|
||||||
}
|
}
|
||||||
impl From<bool> for Opt {
|
impl From<bool> for Opt {
|
||||||
fn from(submit: bool) -> Self { Self { submit } }
|
fn from(submit: bool) -> Self { Self { submit } }
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
use std::path::MAIN_SEPARATOR_STR;
|
use std::{borrow::Cow, path::MAIN_SEPARATOR_STR};
|
||||||
|
|
||||||
use yazi_macro::render;
|
use yazi_macro::render;
|
||||||
use yazi_shared::event::{Cmd, Data};
|
use yazi_shared::event::{CmdCow, Data};
|
||||||
|
|
||||||
use crate::input::Input;
|
use crate::input::Input;
|
||||||
|
|
||||||
|
|
@ -12,12 +12,12 @@ const SEPARATOR: [char; 2] = ['/', '\\'];
|
||||||
const SEPARATOR: char = std::path::MAIN_SEPARATOR;
|
const SEPARATOR: char = std::path::MAIN_SEPARATOR;
|
||||||
|
|
||||||
struct Opt {
|
struct Opt {
|
||||||
word: String,
|
word: Cow<'static, str>,
|
||||||
ticket: usize,
|
ticket: usize,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<Cmd> for Opt {
|
impl From<CmdCow> for Opt {
|
||||||
fn from(mut c: Cmd) -> Self {
|
fn from(mut c: CmdCow) -> Self {
|
||||||
Self {
|
Self {
|
||||||
word: c.take_first_str().unwrap_or_default(),
|
word: c.take_first_str().unwrap_or_default(),
|
||||||
ticket: c.get("ticket").and_then(Data::as_usize).unwrap_or(0),
|
ticket: c.get("ticket").and_then(Data::as_usize).unwrap_or(0),
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
use yazi_macro::render;
|
use yazi_macro::render;
|
||||||
use yazi_shared::event::Cmd;
|
use yazi_shared::event::CmdCow;
|
||||||
|
|
||||||
use crate::input::{Input, op::InputOp};
|
use crate::input::{Input, op::InputOp};
|
||||||
|
|
||||||
|
|
@ -8,8 +8,8 @@ struct Opt {
|
||||||
insert: bool,
|
insert: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<Cmd> for Opt {
|
impl From<CmdCow> for Opt {
|
||||||
fn from(c: Cmd) -> Self { Self { cut: c.bool("cut"), insert: c.bool("insert") } }
|
fn from(c: CmdCow) -> Self { Self { cut: c.bool("cut"), insert: c.bool("insert") } }
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Input {
|
impl Input {
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,13 @@
|
||||||
use yazi_macro::render;
|
use yazi_macro::render;
|
||||||
use yazi_proxy::CompletionProxy;
|
use yazi_proxy::CompletionProxy;
|
||||||
use yazi_shared::event::Cmd;
|
use yazi_shared::event::CmdCow;
|
||||||
|
|
||||||
use crate::input::{Input, InputMode, op::InputOp};
|
use crate::input::{Input, InputMode, op::InputOp};
|
||||||
|
|
||||||
struct Opt;
|
struct Opt;
|
||||||
|
|
||||||
impl From<Cmd> for Opt {
|
impl From<CmdCow> for Opt {
|
||||||
fn from(_: Cmd) -> Self { Self }
|
fn from(_: CmdCow) -> Self { Self }
|
||||||
}
|
}
|
||||||
impl From<()> for Opt {
|
impl From<()> for Opt {
|
||||||
fn from(_: ()) -> Self { Self }
|
fn from(_: ()) -> Self { Self }
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
use yazi_shared::{CharKind, event::Cmd};
|
use yazi_shared::{CharKind, event::CmdCow};
|
||||||
|
|
||||||
use crate::input::{Input, op::InputOp};
|
use crate::input::{Input, op::InputOp};
|
||||||
|
|
||||||
|
|
@ -6,8 +6,8 @@ struct Opt {
|
||||||
end_of_word: bool,
|
end_of_word: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<Cmd> for Opt {
|
impl From<CmdCow> for Opt {
|
||||||
fn from(c: Cmd) -> Self { Self { end_of_word: c.bool("end-of-word") } }
|
fn from(c: CmdCow) -> Self { Self { end_of_word: c.bool("end-of-word") } }
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Input {
|
impl Input {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
use yazi_macro::render;
|
use yazi_macro::render;
|
||||||
use yazi_shared::event::Cmd;
|
use yazi_shared::event::CmdCow;
|
||||||
|
|
||||||
use crate::input::{Input, InputMode, op::InputOp};
|
use crate::input::{Input, InputMode, op::InputOp};
|
||||||
|
|
||||||
|
|
@ -7,8 +7,8 @@ struct Opt {
|
||||||
append: bool,
|
append: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<Cmd> for Opt {
|
impl From<CmdCow> for Opt {
|
||||||
fn from(c: Cmd) -> Self { Self { append: c.bool("append") } }
|
fn from(c: CmdCow) -> Self { Self { append: c.bool("append") } }
|
||||||
}
|
}
|
||||||
impl From<bool> for Opt {
|
impl From<bool> for Opt {
|
||||||
fn from(append: bool) -> Self { Self { append } }
|
fn from(append: bool) -> Self { Self { append } }
|
||||||
|
|
|
||||||
|
|
@ -1,23 +1,23 @@
|
||||||
use std::ops::RangeBounds;
|
use std::{borrow::Cow, ops::RangeBounds};
|
||||||
|
|
||||||
use yazi_macro::render;
|
use yazi_macro::render;
|
||||||
use yazi_shared::{CharKind, event::Cmd};
|
use yazi_shared::{CharKind, event::CmdCow};
|
||||||
|
|
||||||
use crate::input::Input;
|
use crate::input::Input;
|
||||||
|
|
||||||
struct Opt {
|
struct Opt {
|
||||||
kind: String,
|
kind: Cow<'static, str>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<Cmd> for Opt {
|
impl From<CmdCow> for Opt {
|
||||||
fn from(mut c: Cmd) -> Self { Self { kind: c.take_first_str().unwrap_or_default() } }
|
fn from(mut c: CmdCow) -> Self { Self { kind: c.take_first_str().unwrap_or_default() } }
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Input {
|
impl Input {
|
||||||
#[yazi_codegen::command]
|
#[yazi_codegen::command]
|
||||||
pub fn kill(&mut self, opt: Opt) {
|
pub fn kill(&mut self, opt: Opt) {
|
||||||
let snap = self.snap_mut();
|
let snap = self.snap_mut();
|
||||||
match opt.kind.as_str() {
|
match opt.kind.as_ref() {
|
||||||
"all" => self.kill_range(..),
|
"all" => self.kill_range(..),
|
||||||
"bol" => {
|
"bol" => {
|
||||||
let end = snap.idx(snap.cursor).unwrap_or(snap.len());
|
let end = snap.idx(snap.cursor).unwrap_or(snap.len());
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
use unicode_width::UnicodeWidthStr;
|
use unicode_width::UnicodeWidthStr;
|
||||||
use yazi_macro::render;
|
use yazi_macro::render;
|
||||||
use yazi_shared::event::{Cmd, Data};
|
use yazi_shared::event::{CmdCow, Data};
|
||||||
|
|
||||||
use crate::input::{Input, op::InputOp, snap::InputSnap};
|
use crate::input::{Input, op::InputOp, snap::InputSnap};
|
||||||
|
|
||||||
|
|
@ -9,8 +9,8 @@ struct Opt {
|
||||||
in_operating: bool,
|
in_operating: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<Cmd> for Opt {
|
impl From<CmdCow> for Opt {
|
||||||
fn from(c: Cmd) -> Self {
|
fn from(c: CmdCow) -> Self {
|
||||||
Self {
|
Self {
|
||||||
step: c.first().and_then(Data::as_isize).unwrap_or(0),
|
step: c.first().and_then(Data::as_isize).unwrap_or(0),
|
||||||
in_operating: c.bool("in-operating"),
|
in_operating: c.bool("in-operating"),
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
use yazi_macro::render;
|
use yazi_macro::render;
|
||||||
use yazi_plugin::CLIPBOARD;
|
use yazi_plugin::CLIPBOARD;
|
||||||
use yazi_shared::event::Cmd;
|
use yazi_shared::event::CmdCow;
|
||||||
|
|
||||||
use crate::input::{Input, op::InputOp};
|
use crate::input::{Input, op::InputOp};
|
||||||
|
|
||||||
|
|
@ -8,8 +8,8 @@ struct Opt {
|
||||||
before: bool,
|
before: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<Cmd> for Opt {
|
impl From<CmdCow> for Opt {
|
||||||
fn from(c: Cmd) -> Self { Self { before: c.bool("before") } }
|
fn from(c: CmdCow) -> Self { Self { before: c.bool("before") } }
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Input {
|
impl Input {
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
use yazi_macro::render;
|
use yazi_macro::render;
|
||||||
use yazi_shared::event::Cmd;
|
use yazi_shared::event::CmdCow;
|
||||||
|
|
||||||
use crate::input::Input;
|
use crate::input::Input;
|
||||||
|
|
||||||
impl Input {
|
impl Input {
|
||||||
pub fn redo(&mut self, _: Cmd) {
|
pub fn redo(&mut self, _: CmdCow) {
|
||||||
render!(self.snaps.redo());
|
render!(self.snaps.redo());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
use tokio::sync::mpsc;
|
use tokio::sync::mpsc;
|
||||||
use yazi_config::popup::InputCfg;
|
use yazi_config::popup::InputCfg;
|
||||||
use yazi_macro::render;
|
use yazi_macro::render;
|
||||||
use yazi_shared::{errors::InputError, event::Cmd};
|
use yazi_shared::{errors::InputError, event::CmdCow};
|
||||||
|
|
||||||
use crate::input::Input;
|
use crate::input::Input;
|
||||||
|
|
||||||
|
|
@ -10,10 +10,10 @@ pub struct Opt {
|
||||||
tx: mpsc::UnboundedSender<Result<String, InputError>>,
|
tx: mpsc::UnboundedSender<Result<String, InputError>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl TryFrom<Cmd> for Opt {
|
impl TryFrom<CmdCow> for Opt {
|
||||||
type Error = ();
|
type Error = ();
|
||||||
|
|
||||||
fn try_from(mut c: Cmd) -> Result<Self, Self::Error> {
|
fn try_from(mut c: CmdCow) -> Result<Self, Self::Error> {
|
||||||
Ok(Self { cfg: c.take_any("cfg").ok_or(())?, tx: c.take_any("tx").ok_or(())? })
|
Ok(Self { cfg: c.take_any("cfg").ok_or(())?, tx: c.take_any("tx").ok_or(())? })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
use yazi_config::keymap::Key;
|
use yazi_config::keymap::Key;
|
||||||
use yazi_shared::event::Cmd;
|
use yazi_shared::event::CmdCow;
|
||||||
|
|
||||||
use crate::input::{Input, InputMode};
|
use crate::input::{Input, InputMode};
|
||||||
|
|
||||||
struct Opt;
|
struct Opt;
|
||||||
|
|
||||||
impl From<Cmd> for Opt {
|
impl From<CmdCow> for Opt {
|
||||||
fn from(_: Cmd) -> Self { Self }
|
fn from(_: CmdCow) -> Self { Self }
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Input {
|
impl Input {
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
use yazi_macro::render;
|
use yazi_macro::render;
|
||||||
use yazi_shared::event::Cmd;
|
use yazi_shared::event::CmdCow;
|
||||||
|
|
||||||
use crate::input::{Input, InputMode};
|
use crate::input::{Input, InputMode};
|
||||||
|
|
||||||
impl Input {
|
impl Input {
|
||||||
pub fn undo(&mut self, _: Cmd) {
|
pub fn undo(&mut self, _: CmdCow) {
|
||||||
if !self.snaps.undo() {
|
if !self.snaps.undo() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
use yazi_macro::render;
|
use yazi_macro::render;
|
||||||
use yazi_shared::event::Cmd;
|
use yazi_shared::event::CmdCow;
|
||||||
|
|
||||||
use crate::input::{Input, InputMode, op::InputOp};
|
use crate::input::{Input, InputMode, op::InputOp};
|
||||||
|
|
||||||
impl Input {
|
impl Input {
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn visual(&mut self, _: Cmd) {
|
pub fn visual(&mut self, _: CmdCow) {
|
||||||
let snap = self.snap_mut();
|
let snap = self.snap_mut();
|
||||||
if snap.mode != InputMode::Normal {
|
if snap.mode != InputMode::Normal {
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
use yazi_macro::render;
|
use yazi_macro::render;
|
||||||
use yazi_shared::event::Cmd;
|
use yazi_shared::event::CmdCow;
|
||||||
|
|
||||||
use crate::input::{Input, op::InputOp};
|
use crate::input::{Input, op::InputOp};
|
||||||
|
|
||||||
impl Input {
|
impl Input {
|
||||||
pub fn yank(&mut self, _: Cmd) {
|
pub fn yank(&mut self, _: CmdCow) {
|
||||||
match self.snap().op {
|
match self.snap().op {
|
||||||
InputOp::None => {
|
InputOp::None => {
|
||||||
self.snap_mut().op = InputOp::Yank(self.snap().cursor);
|
self.snap_mut().op = InputOp::Yank(self.snap().cursor);
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
use yazi_shared::event::Cmd;
|
use yazi_shared::event::CmdCow;
|
||||||
|
|
||||||
use crate::{manager::Manager, tasks::Tasks};
|
use crate::{manager::Manager, tasks::Tasks};
|
||||||
|
|
||||||
impl Manager {
|
impl Manager {
|
||||||
pub fn close(&mut self, _: Cmd, tasks: &Tasks) {
|
pub fn close(&mut self, _: CmdCow, tasks: &Tasks) {
|
||||||
if self.tabs.len() > 1 {
|
if self.tabs.len() > 1 {
|
||||||
return self.tabs.close(self.tabs.cursor);
|
return self.tabs.close(self.tabs.cursor);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ use anyhow::Result;
|
||||||
use tokio::fs;
|
use tokio::fs;
|
||||||
use yazi_config::popup::{ConfirmCfg, InputCfg};
|
use yazi_config::popup::{ConfirmCfg, InputCfg};
|
||||||
use yazi_proxy::{ConfirmProxy, InputProxy, TabProxy, WATCHER};
|
use yazi_proxy::{ConfirmProxy, InputProxy, TabProxy, WATCHER};
|
||||||
use yazi_shared::{event::Cmd, fs::{File, FilesOp, Url, UrnBuf, maybe_exists, ok_or_not_found, realname}};
|
use yazi_shared::{event::CmdCow, fs::{File, FilesOp, Url, UrnBuf, maybe_exists, ok_or_not_found, realname}};
|
||||||
|
|
||||||
use crate::manager::Manager;
|
use crate::manager::Manager;
|
||||||
|
|
||||||
|
|
@ -13,8 +13,8 @@ struct Opt {
|
||||||
force: bool,
|
force: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<Cmd> for Opt {
|
impl From<CmdCow> for Opt {
|
||||||
fn from(c: Cmd) -> Self { Self { dir: c.bool("dir"), force: c.bool("force") } }
|
fn from(c: CmdCow) -> Self { Self { dir: c.bool("dir"), force: c.bool("force") } }
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Manager {
|
impl Manager {
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
use yazi_shared::event::Cmd;
|
use yazi_shared::event::CmdCow;
|
||||||
|
|
||||||
use crate::{manager::Manager, tasks::Tasks};
|
use crate::{manager::Manager, tasks::Tasks};
|
||||||
|
|
||||||
|
|
@ -7,8 +7,8 @@ struct Opt {
|
||||||
follow: bool,
|
follow: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<Cmd> for Opt {
|
impl From<CmdCow> for Opt {
|
||||||
fn from(c: Cmd) -> Self { Self { force: c.bool("force"), follow: c.bool("follow") } }
|
fn from(c: CmdCow) -> Self { Self { force: c.bool("force"), follow: c.bool("follow") } }
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Manager {
|
impl Manager {
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ use std::{collections::HashSet, path::PathBuf};
|
||||||
|
|
||||||
use yazi_dds::Pubsub;
|
use yazi_dds::Pubsub;
|
||||||
use yazi_macro::render;
|
use yazi_macro::render;
|
||||||
use yazi_shared::{Id, event::{Cmd, Data}, fs::{Url, Urn}};
|
use yazi_shared::{Id, event::{CmdCow, Data}, fs::{Url, Urn}};
|
||||||
|
|
||||||
use crate::manager::Manager;
|
use crate::manager::Manager;
|
||||||
|
|
||||||
|
|
@ -11,9 +11,9 @@ struct Opt {
|
||||||
tab: Option<Id>,
|
tab: Option<Id>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<Cmd> for Opt {
|
impl From<CmdCow> for Opt {
|
||||||
fn from(mut c: Cmd) -> Self {
|
fn from(mut c: CmdCow) -> Self {
|
||||||
Self { url: c.take_first().and_then(Data::into_url), tab: c.get("tab").and_then(Data::as_id) }
|
Self { url: c.take_first_url(), tab: c.get("tab").and_then(Data::as_id) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
impl From<Option<Url>> for Opt {
|
impl From<Option<Url>> for Opt {
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
use yazi_shared::event::Cmd;
|
use yazi_shared::event::CmdCow;
|
||||||
|
|
||||||
use crate::{manager::Manager, tasks::Tasks};
|
use crate::{manager::Manager, tasks::Tasks};
|
||||||
|
|
||||||
|
|
@ -7,8 +7,8 @@ struct Opt {
|
||||||
force: bool,
|
force: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<Cmd> for Opt {
|
impl From<CmdCow> for Opt {
|
||||||
fn from(c: Cmd) -> Self { Self { relative: c.bool("relative"), force: c.bool("force") } }
|
fn from(c: CmdCow) -> Self { Self { relative: c.bool("relative"), force: c.bool("force") } }
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Manager {
|
impl Manager {
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ use yazi_fs::Folder;
|
||||||
use yazi_macro::emit;
|
use yazi_macro::emit;
|
||||||
use yazi_plugin::isolate;
|
use yazi_plugin::isolate;
|
||||||
use yazi_proxy::{ManagerProxy, TasksProxy, options::OpenDoOpt};
|
use yazi_proxy::{ManagerProxy, TasksProxy, options::OpenDoOpt};
|
||||||
use yazi_shared::{MIME_DIR, event::{Cmd, EventQuit}, fs::{File, Url}};
|
use yazi_shared::{MIME_DIR, event::{CmdCow, EventQuit}, fs::{File, Url}};
|
||||||
|
|
||||||
use crate::{manager::Manager, tasks::Tasks};
|
use crate::{manager::Manager, tasks::Tasks};
|
||||||
|
|
||||||
|
|
@ -17,8 +17,8 @@ struct Opt {
|
||||||
hovered: bool,
|
hovered: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<Cmd> for Opt {
|
impl From<CmdCow> for Opt {
|
||||||
fn from(c: Cmd) -> Self {
|
fn from(c: CmdCow) -> Self {
|
||||||
Self { interactive: c.bool("interactive"), hovered: c.bool("hovered") }
|
Self { interactive: c.bool("interactive"), hovered: c.bool("hovered") }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
use yazi_shared::event::Cmd;
|
use yazi_shared::event::CmdCow;
|
||||||
|
|
||||||
use crate::{manager::Manager, tasks::Tasks};
|
use crate::{manager::Manager, tasks::Tasks};
|
||||||
|
|
||||||
|
|
@ -7,8 +7,8 @@ struct Opt {
|
||||||
follow: bool,
|
follow: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<Cmd> for Opt {
|
impl From<CmdCow> for Opt {
|
||||||
fn from(c: Cmd) -> Self { Self { force: c.bool("force"), follow: c.bool("follow") } }
|
fn from(c: CmdCow) -> Self { Self { force: c.bool("force"), follow: c.bool("follow") } }
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Manager {
|
impl Manager {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
use yazi_proxy::HIDER;
|
use yazi_proxy::HIDER;
|
||||||
use yazi_shared::{event::{Cmd, Data}, fs::Url};
|
use yazi_shared::{event::{CmdCow, Data}, fs::Url};
|
||||||
|
|
||||||
use crate::manager::Manager;
|
use crate::manager::Manager;
|
||||||
|
|
||||||
|
|
@ -11,12 +11,12 @@ struct Opt {
|
||||||
upper_bound: bool,
|
upper_bound: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<Cmd> for Opt {
|
impl From<CmdCow> for Opt {
|
||||||
fn from(mut c: Cmd) -> Self {
|
fn from(mut c: CmdCow) -> Self {
|
||||||
Self {
|
Self {
|
||||||
skip: c.first().and_then(Data::as_usize),
|
skip: c.first().and_then(Data::as_usize),
|
||||||
force: c.bool("force"),
|
force: c.bool("force"),
|
||||||
only_if: c.take("only-if").and_then(Data::into_url),
|
only_if: c.take_url("only-if"),
|
||||||
upper_bound: c.bool("upper-bound"),
|
upper_bound: c.bool("upper-bound"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ use tokio::{select, time};
|
||||||
use yazi_config::popup::ConfirmCfg;
|
use yazi_config::popup::ConfirmCfg;
|
||||||
use yazi_macro::emit;
|
use yazi_macro::emit;
|
||||||
use yazi_proxy::ConfirmProxy;
|
use yazi_proxy::ConfirmProxy;
|
||||||
use yazi_shared::event::{Cmd, EventQuit};
|
use yazi_shared::event::{CmdCow, EventQuit};
|
||||||
|
|
||||||
use crate::{manager::Manager, tasks::Tasks};
|
use crate::{manager::Manager, tasks::Tasks};
|
||||||
|
|
||||||
|
|
@ -15,8 +15,8 @@ struct Opt {
|
||||||
impl From<()> for Opt {
|
impl From<()> for Opt {
|
||||||
fn from(_: ()) -> Self { Self::default() }
|
fn from(_: ()) -> Self { Self::default() }
|
||||||
}
|
}
|
||||||
impl From<Cmd> for Opt {
|
impl From<CmdCow> for Opt {
|
||||||
fn from(c: Cmd) -> Self { Self { no_cwd_file: c.bool("no-cwd-file") } }
|
fn from(c: CmdCow) -> Self { Self { no_cwd_file: c.bool("no-cwd-file") } }
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Manager {
|
impl Manager {
|
||||||
|
|
|
||||||
|
|
@ -2,12 +2,12 @@ use std::{env, path::MAIN_SEPARATOR};
|
||||||
|
|
||||||
use crossterm::{execute, terminal::SetTitle};
|
use crossterm::{execute, terminal::SetTitle};
|
||||||
use yazi_config::MANAGER;
|
use yazi_config::MANAGER;
|
||||||
use yazi_shared::event::Cmd;
|
use yazi_shared::event::CmdCow;
|
||||||
|
|
||||||
use crate::{manager::Manager, tasks::Tasks};
|
use crate::{manager::Manager, tasks::Tasks};
|
||||||
|
|
||||||
impl Manager {
|
impl Manager {
|
||||||
pub fn refresh(&mut self, _: Cmd, tasks: &Tasks) {
|
pub fn refresh(&mut self, _: CmdCow, tasks: &Tasks) {
|
||||||
env::set_current_dir(self.cwd()).ok();
|
env::set_current_dir(self.cwd()).ok();
|
||||||
env::set_var("PWD", self.cwd());
|
env::set_var("PWD", self.cwd());
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
use yazi_config::popup::ConfirmCfg;
|
use yazi_config::popup::ConfirmCfg;
|
||||||
use yazi_proxy::{ConfirmProxy, ManagerProxy};
|
use yazi_proxy::{ConfirmProxy, ManagerProxy};
|
||||||
use yazi_shared::{event::Cmd, fs::Url};
|
use yazi_shared::{event::CmdCow, fs::Url};
|
||||||
|
|
||||||
use crate::{manager::Manager, tasks::Tasks};
|
use crate::{manager::Manager, tasks::Tasks};
|
||||||
|
|
||||||
|
|
@ -11,8 +11,8 @@ struct Opt {
|
||||||
targets: Vec<Url>,
|
targets: Vec<Url>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<Cmd> for Opt {
|
impl From<CmdCow> for Opt {
|
||||||
fn from(mut c: Cmd) -> Self {
|
fn from(mut c: CmdCow) -> Self {
|
||||||
Self {
|
Self {
|
||||||
force: c.bool("force"),
|
force: c.bool("force"),
|
||||||
permanently: c.bool("permanently"),
|
permanently: c.bool("permanently"),
|
||||||
|
|
|
||||||
|
|
@ -1,23 +1,23 @@
|
||||||
use std::collections::{HashMap, HashSet};
|
use std::{borrow::Cow, collections::{HashMap, HashSet}};
|
||||||
|
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use tokio::fs;
|
use tokio::fs;
|
||||||
use yazi_config::popup::{ConfirmCfg, InputCfg};
|
use yazi_config::popup::{ConfirmCfg, InputCfg};
|
||||||
use yazi_dds::Pubsub;
|
use yazi_dds::Pubsub;
|
||||||
use yazi_proxy::{ConfirmProxy, InputProxy, TabProxy, WATCHER};
|
use yazi_proxy::{ConfirmProxy, InputProxy, TabProxy, WATCHER};
|
||||||
use yazi_shared::{event::Cmd, fs::{File, FilesOp, Url, UrnBuf, maybe_exists, ok_or_not_found, paths_to_same_file, realname}};
|
use yazi_shared::{event::CmdCow, fs::{File, FilesOp, Url, UrnBuf, maybe_exists, ok_or_not_found, paths_to_same_file, realname}};
|
||||||
|
|
||||||
use crate::manager::Manager;
|
use crate::manager::Manager;
|
||||||
|
|
||||||
struct Opt {
|
struct Opt {
|
||||||
hovered: bool,
|
hovered: bool,
|
||||||
force: bool,
|
force: bool,
|
||||||
empty: String,
|
empty: Cow<'static, str>,
|
||||||
cursor: String,
|
cursor: Cow<'static, str>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<Cmd> for Opt {
|
impl From<CmdCow> for Opt {
|
||||||
fn from(mut c: Cmd) -> Self {
|
fn from(mut c: CmdCow) -> Self {
|
||||||
Self {
|
Self {
|
||||||
hovered: c.bool("hovered"),
|
hovered: c.bool("hovered"),
|
||||||
force: c.bool("force"),
|
force: c.bool("force"),
|
||||||
|
|
@ -42,7 +42,7 @@ impl Manager {
|
||||||
}
|
}
|
||||||
|
|
||||||
let name = Self::empty_url_part(&hovered, &opt.empty);
|
let name = Self::empty_url_part(&hovered, &opt.empty);
|
||||||
let cursor = match opt.cursor.as_str() {
|
let cursor = match opt.cursor.as_ref() {
|
||||||
"start" => Some(0),
|
"start" => Some(0),
|
||||||
"before_ext" => name
|
"before_ext" => name
|
||||||
.chars()
|
.chars()
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
use yazi_config::PLUGIN;
|
use yazi_config::PLUGIN;
|
||||||
use yazi_plugin::isolate;
|
use yazi_plugin::isolate;
|
||||||
use yazi_shared::{MIME_DIR, event::{Cmd, Data}};
|
use yazi_shared::{MIME_DIR, event::{CmdCow, Data}};
|
||||||
|
|
||||||
use crate::manager::Manager;
|
use crate::manager::Manager;
|
||||||
|
|
||||||
|
|
@ -9,8 +9,8 @@ struct Opt {
|
||||||
units: i16,
|
units: i16,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<Cmd> for Opt {
|
impl From<CmdCow> for Opt {
|
||||||
fn from(c: Cmd) -> Self { Self { units: c.first().and_then(Data::as_i16).unwrap_or(0) } }
|
fn from(c: CmdCow) -> Self { Self { units: c.first().and_then(Data::as_i16).unwrap_or(0) } }
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Manager {
|
impl Manager {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
|
|
||||||
use yazi_shared::{MIME_DIR, event::{Cmd, Data}};
|
use yazi_shared::{MIME_DIR, event::{CmdCow, Data}};
|
||||||
|
|
||||||
use crate::manager::Manager;
|
use crate::manager::Manager;
|
||||||
|
|
||||||
|
|
@ -8,8 +8,8 @@ struct Opt {
|
||||||
skip: Option<usize>,
|
skip: Option<usize>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<Cmd> for Opt {
|
impl From<CmdCow> for Opt {
|
||||||
fn from(c: Cmd) -> Self { Self { skip: c.get("skip").and_then(Data::as_usize) } }
|
fn from(c: CmdCow) -> Self { Self { skip: c.get("skip").and_then(Data::as_usize) } }
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Manager {
|
impl Manager {
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
use yazi_shared::event::Cmd;
|
use yazi_shared::event::CmdCow;
|
||||||
|
|
||||||
use crate::manager::Manager;
|
use crate::manager::Manager;
|
||||||
|
|
||||||
impl Manager {
|
impl Manager {
|
||||||
pub fn suspend(&mut self, _: Cmd) {
|
pub fn suspend(&mut self, _: CmdCow) {
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
unsafe {
|
unsafe {
|
||||||
libc::raise(libc::SIGTSTP);
|
libc::raise(libc::SIGTSTP);
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
use yazi_macro::render;
|
use yazi_macro::render;
|
||||||
use yazi_shared::event::{Cmd, Data};
|
use yazi_shared::event::{CmdCow, Data};
|
||||||
|
|
||||||
use crate::manager::Tabs;
|
use crate::manager::Tabs;
|
||||||
|
|
||||||
|
|
@ -7,8 +7,8 @@ struct Opt {
|
||||||
idx: usize,
|
idx: usize,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<Cmd> for Opt {
|
impl From<CmdCow> for Opt {
|
||||||
fn from(c: Cmd) -> Self { Self { idx: c.first().and_then(Data::as_usize).unwrap_or(0) } }
|
fn from(c: CmdCow) -> Self { Self { idx: c.first().and_then(Data::as_usize).unwrap_or(0) } }
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<usize> for Opt {
|
impl From<usize> for Opt {
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
use yazi_boot::BOOT;
|
use yazi_boot::BOOT;
|
||||||
use yazi_macro::render;
|
use yazi_macro::render;
|
||||||
use yazi_proxy::AppProxy;
|
use yazi_proxy::AppProxy;
|
||||||
use yazi_shared::{event::{Cmd, Data}, fs::Url};
|
use yazi_shared::{event::CmdCow, fs::Url};
|
||||||
|
|
||||||
use crate::{manager::Tabs, tab::Tab};
|
use crate::{manager::Tabs, tab::Tab};
|
||||||
|
|
||||||
|
|
@ -12,16 +12,13 @@ struct Opt {
|
||||||
current: bool,
|
current: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<Cmd> for Opt {
|
impl From<CmdCow> for Opt {
|
||||||
fn from(mut c: Cmd) -> Self {
|
fn from(mut c: CmdCow) -> Self {
|
||||||
if c.bool("current") {
|
if c.bool("current") {
|
||||||
Self { url: Default::default(), current: true }
|
Self { url: Default::default(), current: true }
|
||||||
} else {
|
} else {
|
||||||
Self {
|
Self {
|
||||||
url: c
|
url: c.take_first_url().unwrap_or_else(|| Url::from(&BOOT.cwds[0])),
|
||||||
.take_first()
|
|
||||||
.and_then(Data::into_url)
|
|
||||||
.unwrap_or_else(|| Url::from(&BOOT.cwds[0])),
|
|
||||||
current: false,
|
current: false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
use yazi_macro::render;
|
use yazi_macro::render;
|
||||||
use yazi_shared::event::{Cmd, Data};
|
use yazi_shared::event::{CmdCow, Data};
|
||||||
|
|
||||||
use crate::manager::Tabs;
|
use crate::manager::Tabs;
|
||||||
|
|
||||||
|
|
@ -7,8 +7,8 @@ struct Opt {
|
||||||
step: isize,
|
step: isize,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<Cmd> for Opt {
|
impl From<CmdCow> for Opt {
|
||||||
fn from(c: Cmd) -> Self { Self { step: c.first().and_then(Data::as_isize).unwrap_or(0) } }
|
fn from(c: CmdCow) -> Self { Self { step: c.first().and_then(Data::as_isize).unwrap_or(0) } }
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Tabs {
|
impl Tabs {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
use yazi_macro::render;
|
use yazi_macro::render;
|
||||||
use yazi_shared::event::{Cmd, Data};
|
use yazi_shared::event::{CmdCow, Data};
|
||||||
|
|
||||||
use crate::manager::Tabs;
|
use crate::manager::Tabs;
|
||||||
|
|
||||||
|
|
@ -8,8 +8,8 @@ struct Opt {
|
||||||
relative: bool,
|
relative: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<Cmd> for Opt {
|
impl From<CmdCow> for Opt {
|
||||||
fn from(c: Cmd) -> Self {
|
fn from(c: CmdCow) -> Self {
|
||||||
Self { step: c.first().and_then(Data::as_isize).unwrap_or(0), relative: c.bool("relative") }
|
Self { step: c.first().and_then(Data::as_isize).unwrap_or(0), relative: c.bool("relative") }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
use yazi_macro::render;
|
use yazi_macro::render;
|
||||||
use yazi_shared::event::Cmd;
|
use yazi_shared::event::CmdCow;
|
||||||
|
|
||||||
use crate::manager::Manager;
|
use crate::manager::Manager;
|
||||||
|
|
||||||
struct Opt;
|
struct Opt;
|
||||||
|
|
||||||
impl From<Cmd> for Opt {
|
impl From<CmdCow> for Opt {
|
||||||
fn from(_: Cmd) -> Self { Self }
|
fn from(_: CmdCow) -> Self { Self }
|
||||||
}
|
}
|
||||||
impl From<()> for Opt {
|
impl From<()> for Opt {
|
||||||
fn from(_: ()) -> Self { Self }
|
fn from(_: ()) -> Self { Self }
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ use std::borrow::Cow;
|
||||||
use yazi_fs::Folder;
|
use yazi_fs::Folder;
|
||||||
use yazi_macro::render;
|
use yazi_macro::render;
|
||||||
use yazi_proxy::ManagerProxy;
|
use yazi_proxy::ManagerProxy;
|
||||||
use yazi_shared::{event::Cmd, fs::FilesOp};
|
use yazi_shared::{event::CmdCow, fs::FilesOp};
|
||||||
|
|
||||||
use crate::{manager::{LINKED, Manager}, tab::Tab, tasks::Tasks};
|
use crate::{manager::{LINKED, Manager}, tab::Tab, tasks::Tasks};
|
||||||
|
|
||||||
|
|
@ -11,10 +11,10 @@ pub struct Opt {
|
||||||
op: FilesOp,
|
op: FilesOp,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl TryFrom<Cmd> for Opt {
|
impl TryFrom<CmdCow> for Opt {
|
||||||
type Error = ();
|
type Error = ();
|
||||||
|
|
||||||
fn try_from(mut c: Cmd) -> Result<Self, Self::Error> {
|
fn try_from(mut c: CmdCow) -> Result<Self, Self::Error> {
|
||||||
Ok(Self { op: c.take_any("op").ok_or(())? })
|
Ok(Self { op: c.take_any("op").ok_or(())? })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ use std::collections::HashMap;
|
||||||
|
|
||||||
use tracing::error;
|
use tracing::error;
|
||||||
use yazi_macro::render;
|
use yazi_macro::render;
|
||||||
use yazi_shared::{event::Cmd, fs::Url};
|
use yazi_shared::{event::CmdCow, fs::Url};
|
||||||
|
|
||||||
use crate::{manager::{LINKED, Manager}, tasks::Tasks};
|
use crate::{manager::{LINKED, Manager}, tasks::Tasks};
|
||||||
|
|
||||||
|
|
@ -10,11 +10,11 @@ pub struct Opt {
|
||||||
updates: HashMap<String, String>,
|
updates: HashMap<String, String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl TryFrom<Cmd> for Opt {
|
impl TryFrom<CmdCow> for Opt {
|
||||||
type Error = ();
|
type Error = ();
|
||||||
|
|
||||||
fn try_from(mut c: Cmd) -> Result<Self, Self::Error> {
|
fn try_from(mut c: CmdCow) -> Result<Self, Self::Error> {
|
||||||
Ok(Self { updates: c.take("updates").ok_or(())?.into_dict_string() })
|
Ok(Self { updates: c.try_take("updates").ok_or(())?.into_dict_string() })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
use yazi_shared::{event::{Cmd, Data}, fs::Url};
|
use yazi_shared::{event::{CmdCow, Data}, fs::Url};
|
||||||
|
|
||||||
use crate::{manager::Manager, tasks::Tasks};
|
use crate::{manager::Manager, tasks::Tasks};
|
||||||
|
|
||||||
|
|
@ -8,12 +8,9 @@ pub struct Opt {
|
||||||
only_if: Option<Url>,
|
only_if: Option<Url>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<Cmd> for Opt {
|
impl From<CmdCow> for Opt {
|
||||||
fn from(mut c: Cmd) -> Self {
|
fn from(mut c: CmdCow) -> Self {
|
||||||
Self {
|
Self { page: c.first().and_then(Data::as_usize), only_if: c.take_url("only-if") }
|
||||||
page: c.first().and_then(Data::as_usize),
|
|
||||||
only_if: c.take("only-if").and_then(Data::into_url),
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
use yazi_shared::{event::Cmd, fs::Url};
|
use yazi_shared::{event::CmdCow, fs::Url};
|
||||||
|
|
||||||
use crate::manager::Manager;
|
use crate::manager::Manager;
|
||||||
|
|
||||||
|
|
@ -6,10 +6,10 @@ pub struct Opt {
|
||||||
urls: Vec<Url>,
|
urls: Vec<Url>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl TryFrom<Cmd> for Opt {
|
impl TryFrom<CmdCow> for Opt {
|
||||||
type Error = ();
|
type Error = ();
|
||||||
|
|
||||||
fn try_from(mut c: Cmd) -> Result<Self, Self::Error> {
|
fn try_from(mut c: CmdCow) -> Result<Self, Self::Error> {
|
||||||
Ok(Self { urls: c.take_any("urls").ok_or(())? })
|
Ok(Self { urls: c.take_any("urls").ok_or(())? })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
use std::collections::HashSet;
|
use std::collections::HashSet;
|
||||||
|
|
||||||
use yazi_macro::render;
|
use yazi_macro::render;
|
||||||
use yazi_shared::{event::Cmd, fs::Url};
|
use yazi_shared::{event::CmdCow, fs::Url};
|
||||||
|
|
||||||
use crate::manager::{Manager, Yanked};
|
use crate::manager::{Manager, Yanked};
|
||||||
|
|
||||||
|
|
@ -11,10 +11,10 @@ pub struct Opt {
|
||||||
urls: HashSet<Url>,
|
urls: HashSet<Url>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl TryFrom<Cmd> for Opt {
|
impl TryFrom<CmdCow> for Opt {
|
||||||
type Error = ();
|
type Error = ();
|
||||||
|
|
||||||
fn try_from(mut c: Cmd) -> Result<Self, Self::Error> {
|
fn try_from(mut c: CmdCow) -> Result<Self, Self::Error> {
|
||||||
if let Some(iter) = c.take_any::<yazi_dds::body::BodyYankIter>("urls") {
|
if let Some(iter) = c.take_any::<yazi_dds::body::BodyYankIter>("urls") {
|
||||||
Ok(Self { urls: iter.urls.into_iter().collect(), cut: iter.cut })
|
Ok(Self { urls: iter.urls.into_iter().collect(), cut: iter.cut })
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
use yazi_macro::render;
|
use yazi_macro::render;
|
||||||
use yazi_shared::event::Cmd;
|
use yazi_shared::event::CmdCow;
|
||||||
|
|
||||||
use crate::manager::{Manager, Yanked};
|
use crate::manager::{Manager, Yanked};
|
||||||
|
|
||||||
|
|
@ -7,8 +7,8 @@ struct Opt {
|
||||||
cut: bool,
|
cut: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<Cmd> for Opt {
|
impl From<CmdCow> for Opt {
|
||||||
fn from(c: Cmd) -> Self { Self { cut: c.bool("cut") } }
|
fn from(c: CmdCow) -> Self { Self { cut: c.bool("cut") } }
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Manager {
|
impl Manager {
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ use std::time::Duration;
|
||||||
|
|
||||||
use ratatui::layout::Rect;
|
use ratatui::layout::Rect;
|
||||||
use yazi_macro::emit;
|
use yazi_macro::emit;
|
||||||
use yazi_shared::{Layer, event::{Cmd, Data}};
|
use yazi_shared::{Layer, event::{Cmd, CmdCow, Data}};
|
||||||
|
|
||||||
use crate::notify::Notify;
|
use crate::notify::Notify;
|
||||||
|
|
||||||
|
|
@ -10,10 +10,10 @@ pub struct Opt {
|
||||||
interval: Duration,
|
interval: Duration,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl TryFrom<Cmd> for Opt {
|
impl TryFrom<CmdCow> for Opt {
|
||||||
type Error = ();
|
type Error = ();
|
||||||
|
|
||||||
fn try_from(c: Cmd) -> Result<Self, Self::Error> {
|
fn try_from(c: CmdCow) -> Result<Self, Self::Error> {
|
||||||
let interval = c.first().and_then(Data::as_f64).ok_or(())?;
|
let interval = c.first().and_then(Data::as_f64).ok_or(())?;
|
||||||
if interval < 0.0 {
|
if interval < 0.0 {
|
||||||
return Err(());
|
return Err(());
|
||||||
|
|
@ -23,6 +23,12 @@ impl TryFrom<Cmd> for Opt {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl TryFrom<Cmd> for Opt {
|
||||||
|
type Error = ();
|
||||||
|
|
||||||
|
fn try_from(c: Cmd) -> Result<Self, Self::Error> { Self::try_from(CmdCow::from(c)) }
|
||||||
|
}
|
||||||
|
|
||||||
impl Notify {
|
impl Notify {
|
||||||
pub fn tick(&mut self, opt: impl TryInto<Opt>, area: Rect) {
|
pub fn tick(&mut self, opt: impl TryInto<Opt>, area: Rect) {
|
||||||
self.tick_handle.take().map(|h| h.abort());
|
self.tick_handle.take().map(|h| h.abort());
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
use yazi_macro::render;
|
use yazi_macro::render;
|
||||||
use yazi_shared::event::{Cmd, Data};
|
use yazi_shared::event::{CmdCow, Data};
|
||||||
|
|
||||||
use crate::pick::Pick;
|
use crate::pick::Pick;
|
||||||
|
|
||||||
|
|
@ -7,8 +7,8 @@ struct Opt {
|
||||||
step: isize,
|
step: isize,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<Cmd> for Opt {
|
impl From<CmdCow> for Opt {
|
||||||
fn from(c: Cmd) -> Self { Self { step: c.first().and_then(Data::as_isize).unwrap_or(0) } }
|
fn from(c: CmdCow) -> Self { Self { step: c.first().and_then(Data::as_isize).unwrap_or(0) } }
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Pick {
|
impl Pick {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
use anyhow::anyhow;
|
use anyhow::anyhow;
|
||||||
use yazi_macro::render;
|
use yazi_macro::render;
|
||||||
use yazi_shared::event::Cmd;
|
use yazi_shared::event::CmdCow;
|
||||||
|
|
||||||
use crate::pick::Pick;
|
use crate::pick::Pick;
|
||||||
|
|
||||||
|
|
@ -8,8 +8,8 @@ struct Opt {
|
||||||
submit: bool,
|
submit: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<Cmd> for Opt {
|
impl From<CmdCow> for Opt {
|
||||||
fn from(c: Cmd) -> Self { Self { submit: c.bool("submit") } }
|
fn from(c: CmdCow) -> Self { Self { submit: c.bool("submit") } }
|
||||||
}
|
}
|
||||||
impl From<bool> for Opt {
|
impl From<bool> for Opt {
|
||||||
fn from(submit: bool) -> Self { Self { submit } }
|
fn from(submit: bool) -> Self { Self { submit } }
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
use tokio::sync::oneshot;
|
use tokio::sync::oneshot;
|
||||||
use yazi_config::popup::PickCfg;
|
use yazi_config::popup::PickCfg;
|
||||||
use yazi_macro::render;
|
use yazi_macro::render;
|
||||||
use yazi_shared::event::Cmd;
|
use yazi_shared::event::CmdCow;
|
||||||
|
|
||||||
use crate::pick::Pick;
|
use crate::pick::Pick;
|
||||||
|
|
||||||
|
|
@ -10,10 +10,10 @@ pub struct Opt {
|
||||||
tx: oneshot::Sender<anyhow::Result<usize>>,
|
tx: oneshot::Sender<anyhow::Result<usize>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl TryFrom<Cmd> for Opt {
|
impl TryFrom<CmdCow> for Opt {
|
||||||
type Error = ();
|
type Error = ();
|
||||||
|
|
||||||
fn try_from(mut c: Cmd) -> Result<Self, Self::Error> {
|
fn try_from(mut c: CmdCow) -> Result<Self, Self::Error> {
|
||||||
Ok(Self { cfg: c.take_any("cfg").ok_or(())?, tx: c.take_any("tx").ok_or(())? })
|
Ok(Self { cfg: c.take_any("cfg").ok_or(())?, tx: c.take_any("tx").ok_or(())? })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
use yazi_macro::render;
|
use yazi_macro::render;
|
||||||
use yazi_proxy::ManagerProxy;
|
use yazi_proxy::ManagerProxy;
|
||||||
use yazi_shared::event::{Cmd, Data};
|
use yazi_shared::event::{CmdCow, Data};
|
||||||
|
|
||||||
use crate::spot::Spot;
|
use crate::spot::Spot;
|
||||||
|
|
||||||
|
|
@ -8,8 +8,8 @@ struct Opt {
|
||||||
step: isize,
|
step: isize,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<Cmd> for Opt {
|
impl From<CmdCow> for Opt {
|
||||||
fn from(c: Cmd) -> Self { Self { step: c.first().and_then(Data::as_isize).unwrap_or(0) } }
|
fn from(c: CmdCow) -> Self { Self { step: c.first().and_then(Data::as_isize).unwrap_or(0) } }
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Spot {
|
impl Spot {
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
use yazi_macro::render;
|
use yazi_macro::render;
|
||||||
use yazi_shared::event::Cmd;
|
use yazi_shared::event::CmdCow;
|
||||||
|
|
||||||
use crate::spot::Spot;
|
use crate::spot::Spot;
|
||||||
|
|
||||||
struct Opt;
|
struct Opt;
|
||||||
|
|
||||||
impl From<Cmd> for Opt {
|
impl From<CmdCow> for Opt {
|
||||||
fn from(_: Cmd) -> Self { Self }
|
fn from(_: CmdCow) -> Self { Self }
|
||||||
}
|
}
|
||||||
impl From<()> for Opt {
|
impl From<()> for Opt {
|
||||||
fn from(_: ()) -> Self { Self }
|
fn from(_: ()) -> Self { Self }
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,16 @@
|
||||||
|
use std::borrow::Cow;
|
||||||
|
|
||||||
use yazi_plugin::CLIPBOARD;
|
use yazi_plugin::CLIPBOARD;
|
||||||
use yazi_shared::event::Cmd;
|
use yazi_shared::event::CmdCow;
|
||||||
|
|
||||||
use crate::spot::Spot;
|
use crate::spot::Spot;
|
||||||
|
|
||||||
struct Opt {
|
struct Opt {
|
||||||
type_: String,
|
type_: Cow<'static, str>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<Cmd> for Opt {
|
impl From<CmdCow> for Opt {
|
||||||
fn from(mut c: Cmd) -> Self { Self { type_: c.take_first_str().unwrap_or_default() } }
|
fn from(mut c: CmdCow) -> Self { Self { type_: c.take_first_str().unwrap_or_default() } }
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Spot {
|
impl Spot {
|
||||||
|
|
@ -18,7 +20,7 @@ impl Spot {
|
||||||
let Some(table) = lock.table() else { return };
|
let Some(table) = lock.table() else { return };
|
||||||
|
|
||||||
let mut s = String::new();
|
let mut s = String::new();
|
||||||
match opt.type_.as_str() {
|
match opt.type_.as_ref() {
|
||||||
"cell" => {
|
"cell" => {
|
||||||
let Some(cell) = table.selected_cell() else { return };
|
let Some(cell) = table.selected_cell() else { return };
|
||||||
s = cell.to_string();
|
s = cell.to_string();
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
use yazi_proxy::{ManagerProxy, TabProxy};
|
use yazi_proxy::{ManagerProxy, TabProxy};
|
||||||
use yazi_shared::event::{Cmd, Data};
|
use yazi_shared::event::{CmdCow, Data};
|
||||||
|
|
||||||
use crate::spot::Spot;
|
use crate::spot::Spot;
|
||||||
|
|
||||||
|
|
@ -7,8 +7,8 @@ struct Opt {
|
||||||
step: isize,
|
step: isize,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<Cmd> for Opt {
|
impl From<CmdCow> for Opt {
|
||||||
fn from(c: Cmd) -> Self { Self { step: c.first().and_then(Data::as_isize).unwrap_or(0) } }
|
fn from(c: CmdCow) -> Self { Self { step: c.first().and_then(Data::as_isize).unwrap_or(0) } }
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Spot {
|
impl Spot {
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
use yazi_fs::Step;
|
use yazi_fs::Step;
|
||||||
use yazi_macro::render;
|
use yazi_macro::render;
|
||||||
use yazi_proxy::ManagerProxy;
|
use yazi_proxy::ManagerProxy;
|
||||||
use yazi_shared::event::{Cmd, Data};
|
use yazi_shared::event::{CmdCow, Data};
|
||||||
|
|
||||||
use crate::tab::Tab;
|
use crate::tab::Tab;
|
||||||
|
|
||||||
|
|
@ -9,10 +9,10 @@ struct Opt {
|
||||||
step: Step,
|
step: Step,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<Cmd> for Opt {
|
impl From<CmdCow> for Opt {
|
||||||
fn from(mut c: Cmd) -> Self {
|
fn from(c: CmdCow) -> Self {
|
||||||
let step = match c.take_first() {
|
let step = match c.first() {
|
||||||
Some(Data::Integer(i)) => Step::from(i as isize),
|
Some(Data::Integer(i)) => Step::from(*i as isize),
|
||||||
Some(Data::String(s)) => s.parse().unwrap_or_default(),
|
Some(Data::String(s)) => s.parse().unwrap_or_default(),
|
||||||
_ => Step::default(),
|
_ => Step::default(),
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,9 @@
|
||||||
use yazi_shared::event::Cmd;
|
use yazi_shared::event::CmdCow;
|
||||||
|
|
||||||
use crate::tab::Tab;
|
use crate::tab::Tab;
|
||||||
|
|
||||||
impl Tab {
|
impl Tab {
|
||||||
pub fn back(&mut self, _: Cmd) { self.backstack.shift_backward().cloned().map(|u| self.cd(u)); }
|
pub fn back(&mut self, _: CmdCow) {
|
||||||
|
self.backstack.shift_backward().cloned().map(|u| self.cd(u));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ use yazi_config::popup::InputCfg;
|
||||||
use yazi_dds::Pubsub;
|
use yazi_dds::Pubsub;
|
||||||
use yazi_macro::render;
|
use yazi_macro::render;
|
||||||
use yazi_proxy::{CompletionProxy, InputProxy, ManagerProxy, TabProxy};
|
use yazi_proxy::{CompletionProxy, InputProxy, ManagerProxy, TabProxy};
|
||||||
use yazi_shared::{Debounce, errors::InputError, event::{Cmd, Data}, fs::{Url, expand_path}};
|
use yazi_shared::{Debounce, errors::InputError, event::CmdCow, fs::{Url, expand_path}};
|
||||||
|
|
||||||
use crate::tab::Tab;
|
use crate::tab::Tab;
|
||||||
|
|
||||||
|
|
@ -15,11 +15,11 @@ struct Opt {
|
||||||
interactive: bool,
|
interactive: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<Cmd> for Opt {
|
impl From<CmdCow> for Opt {
|
||||||
fn from(mut c: Cmd) -> Self {
|
fn from(mut c: CmdCow) -> Self {
|
||||||
Self {
|
Self {
|
||||||
interactive: c.bool("interactive"),
|
interactive: c.bool("interactive"),
|
||||||
..Self::from(c.take_first().and_then(Data::into_url).unwrap_or_default())
|
..Self::from(c.take_first_url().unwrap_or_default())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,17 @@
|
||||||
use std::{borrow::Cow, ffi::{OsStr, OsString}, path::Path};
|
use std::{borrow::Cow, ffi::{OsStr, OsString}, path::Path};
|
||||||
|
|
||||||
use yazi_plugin::CLIPBOARD;
|
use yazi_plugin::CLIPBOARD;
|
||||||
use yazi_shared::event::Cmd;
|
use yazi_shared::event::CmdCow;
|
||||||
|
|
||||||
use crate::tab::Tab;
|
use crate::tab::Tab;
|
||||||
|
|
||||||
struct Opt {
|
struct Opt {
|
||||||
type_: String,
|
type_: Cow<'static, str>,
|
||||||
separator: Separator,
|
separator: Separator,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<Cmd> for Opt {
|
impl From<CmdCow> for Opt {
|
||||||
fn from(mut c: Cmd) -> Self {
|
fn from(mut c: CmdCow) -> Self {
|
||||||
Self {
|
Self {
|
||||||
type_: c.take_first_str().unwrap_or_default(),
|
type_: c.take_first_str().unwrap_or_default(),
|
||||||
separator: c.str("separator").unwrap_or_default().into(),
|
separator: c.str("separator").unwrap_or_default().into(),
|
||||||
|
|
@ -29,7 +29,7 @@ impl Tab {
|
||||||
let mut s = OsString::new();
|
let mut s = OsString::new();
|
||||||
let mut it = self.selected_or_hovered(true).peekable();
|
let mut it = self.selected_or_hovered(true).peekable();
|
||||||
while let Some(u) = it.next() {
|
while let Some(u) = it.next() {
|
||||||
s.push(match opt.type_.as_str() {
|
s.push(match opt.type_.as_ref() {
|
||||||
"path" => opt.separator.transform(u),
|
"path" => opt.separator.transform(u),
|
||||||
"dirname" => opt.separator.transform(u.parent().unwrap_or(Path::new(""))),
|
"dirname" => opt.separator.transform(u.parent().unwrap_or(Path::new(""))),
|
||||||
"filename" => opt.separator.transform(u.name()),
|
"filename" => opt.separator.transform(u.name()),
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
use yazi_shared::event::Cmd;
|
use yazi_shared::event::CmdCow;
|
||||||
|
|
||||||
use crate::tab::Tab;
|
use crate::tab::Tab;
|
||||||
|
|
||||||
impl Tab {
|
impl Tab {
|
||||||
pub fn enter(&mut self, _: Cmd) {
|
pub fn enter(&mut self, _: CmdCow) {
|
||||||
self.hovered().filter(|h| h.is_dir()).map(|h| h.url.to_regular()).map(|u| self.cd(u));
|
self.hovered().filter(|h| h.is_dir()).map(|h| h.url.to_regular()).map(|u| self.cd(u));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
use bitflags::bitflags;
|
use bitflags::bitflags;
|
||||||
use yazi_macro::{render, render_and};
|
use yazi_macro::{render, render_and};
|
||||||
use yazi_proxy::{AppProxy, ManagerProxy};
|
use yazi_proxy::{AppProxy, ManagerProxy};
|
||||||
use yazi_shared::event::Cmd;
|
use yazi_shared::event::CmdCow;
|
||||||
|
|
||||||
use crate::tab::Tab;
|
use crate::tab::Tab;
|
||||||
|
|
||||||
|
|
@ -15,8 +15,8 @@ bitflags! {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<Cmd> for Opt {
|
impl From<CmdCow> for Opt {
|
||||||
fn from(c: Cmd) -> Self {
|
fn from(c: CmdCow) -> Self {
|
||||||
c.args.iter().fold(Opt::empty(), |acc, (k, v)| {
|
c.args.iter().fold(Opt::empty(), |acc, (k, v)| {
|
||||||
match (k.as_str(), v.as_bool().unwrap_or(false)) {
|
match (k.as_str(), v.as_bool().unwrap_or(false)) {
|
||||||
("all", true) => Self::all(),
|
("all", true) => Self::all(),
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
use std::time::Duration;
|
use std::{borrow::Cow, time::Duration};
|
||||||
|
|
||||||
use tokio::pin;
|
use tokio::pin;
|
||||||
use tokio_stream::{StreamExt, wrappers::UnboundedReceiverStream};
|
use tokio_stream::{StreamExt, wrappers::UnboundedReceiverStream};
|
||||||
|
|
@ -6,22 +6,22 @@ use yazi_config::popup::InputCfg;
|
||||||
use yazi_fs::FilterCase;
|
use yazi_fs::FilterCase;
|
||||||
use yazi_macro::emit;
|
use yazi_macro::emit;
|
||||||
use yazi_proxy::InputProxy;
|
use yazi_proxy::InputProxy;
|
||||||
use yazi_shared::{Debounce, Layer, errors::InputError, event::Cmd};
|
use yazi_shared::{Debounce, Layer, errors::InputError, event::{Cmd, CmdCow}};
|
||||||
|
|
||||||
use crate::tab::Tab;
|
use crate::tab::Tab;
|
||||||
|
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
pub(super) struct Opt {
|
pub(super) struct Opt {
|
||||||
pub query: String,
|
pub query: Cow<'static, str>,
|
||||||
pub case: FilterCase,
|
pub case: FilterCase,
|
||||||
pub done: bool,
|
pub done: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<Cmd> for Opt {
|
impl From<CmdCow> for Opt {
|
||||||
fn from(mut c: Cmd) -> Self {
|
fn from(mut c: CmdCow) -> Self {
|
||||||
Self {
|
Self {
|
||||||
query: c.take_first_str().unwrap_or_default(),
|
query: c.take_first_str().unwrap_or_default(),
|
||||||
case: FilterCase::from(&c),
|
case: FilterCase::from(&*c),
|
||||||
done: c.bool("done"),
|
done: c.bool("done"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
use std::time::Duration;
|
use std::{borrow::Cow, time::Duration};
|
||||||
|
|
||||||
use tokio::pin;
|
use tokio::pin;
|
||||||
use tokio_stream::{StreamExt, wrappers::UnboundedReceiverStream};
|
use tokio_stream::{StreamExt, wrappers::UnboundedReceiverStream};
|
||||||
|
|
@ -6,19 +6,19 @@ use yazi_config::popup::InputCfg;
|
||||||
use yazi_fs::FilterCase;
|
use yazi_fs::FilterCase;
|
||||||
use yazi_macro::emit;
|
use yazi_macro::emit;
|
||||||
use yazi_proxy::InputProxy;
|
use yazi_proxy::InputProxy;
|
||||||
use yazi_shared::{Debounce, Layer, errors::InputError, event::Cmd};
|
use yazi_shared::{Debounce, Layer, errors::InputError, event::{Cmd, CmdCow}};
|
||||||
|
|
||||||
use crate::tab::Tab;
|
use crate::tab::Tab;
|
||||||
|
|
||||||
pub(super) struct Opt {
|
pub(super) struct Opt {
|
||||||
pub(super) query: Option<String>,
|
pub(super) query: Option<Cow<'static, str>>,
|
||||||
pub(super) prev: bool,
|
pub(super) prev: bool,
|
||||||
pub(super) case: FilterCase,
|
pub(super) case: FilterCase,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<Cmd> for Opt {
|
impl From<CmdCow> for Opt {
|
||||||
fn from(mut c: Cmd) -> Self {
|
fn from(mut c: CmdCow) -> Self {
|
||||||
Self { query: c.take_first_str(), prev: c.bool("previous"), case: FilterCase::from(&c) }
|
Self { query: c.take_first_str(), prev: c.bool("previous"), case: FilterCase::from(&*c) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
use yazi_macro::render;
|
use yazi_macro::render;
|
||||||
use yazi_shared::event::Cmd;
|
use yazi_shared::event::CmdCow;
|
||||||
|
|
||||||
use crate::tab::Tab;
|
use crate::tab::Tab;
|
||||||
|
|
||||||
|
|
@ -7,8 +7,8 @@ struct Opt {
|
||||||
prev: bool,
|
prev: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<Cmd> for Opt {
|
impl From<CmdCow> for Opt {
|
||||||
fn from(c: Cmd) -> Self { Self { prev: c.bool("previous") } }
|
fn from(c: CmdCow) -> Self { Self { prev: c.bool("previous") } }
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Tab {
|
impl Tab {
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,9 @@
|
||||||
use yazi_shared::event::Cmd;
|
use yazi_shared::event::CmdCow;
|
||||||
|
|
||||||
use crate::tab::Tab;
|
use crate::tab::Tab;
|
||||||
|
|
||||||
impl Tab {
|
impl Tab {
|
||||||
pub fn forward(&mut self, _: Cmd) { self.backstack.shift_forward().cloned().map(|u| self.cd(u)); }
|
pub fn forward(&mut self, _: CmdCow) {
|
||||||
|
self.backstack.shift_forward().cloned().map(|u| self.cd(u));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
use yazi_proxy::ManagerProxy;
|
use yazi_proxy::ManagerProxy;
|
||||||
use yazi_shared::event::Cmd;
|
use yazi_shared::event::CmdCow;
|
||||||
|
|
||||||
use crate::tab::Tab;
|
use crate::tab::Tab;
|
||||||
|
|
||||||
impl Tab {
|
impl Tab {
|
||||||
pub fn hidden(&mut self, mut c: Cmd) {
|
pub fn hidden(&mut self, mut c: CmdCow) {
|
||||||
self.pref.show_hidden = match c.take_first_str().as_deref() {
|
self.pref.show_hidden = match c.take_first_str().as_deref() {
|
||||||
Some("show") => true,
|
Some("show") => true,
|
||||||
Some("hide") => false,
|
Some("hide") => false,
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
use yazi_shared::event::Cmd;
|
use yazi_shared::event::CmdCow;
|
||||||
|
|
||||||
use crate::tab::Tab;
|
use crate::tab::Tab;
|
||||||
|
|
||||||
|
|
@ -6,8 +6,8 @@ struct Opt;
|
||||||
impl From<()> for Opt {
|
impl From<()> for Opt {
|
||||||
fn from(_: ()) -> Self { Self }
|
fn from(_: ()) -> Self { Self }
|
||||||
}
|
}
|
||||||
impl From<Cmd> for Opt {
|
impl From<CmdCow> for Opt {
|
||||||
fn from(_: Cmd) -> Self { Self }
|
fn from(_: CmdCow) -> Self { Self }
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Tab {
|
impl Tab {
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,16 @@
|
||||||
use yazi_macro::render;
|
use yazi_macro::render;
|
||||||
use yazi_shared::event::Cmd;
|
use yazi_shared::event::CmdCow;
|
||||||
|
|
||||||
use crate::tab::Tab;
|
use crate::tab::Tab;
|
||||||
|
|
||||||
impl Tab {
|
impl Tab {
|
||||||
pub fn linemode(&mut self, mut c: Cmd) {
|
pub fn linemode(&mut self, mut c: CmdCow) {
|
||||||
render!(self.pref.patch(|new| {
|
render!(self.pref.patch(|new| {
|
||||||
let Some(mode) = c.take_first_str() else {
|
let Some(mode) = c.take_first_str() else {
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
if !mode.is_empty() && mode.len() <= 20 {
|
if !mode.is_empty() && mode.len() <= 20 {
|
||||||
new.linemode = mode;
|
new.linemode = mode.into_owned();
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
use yazi_proxy::ManagerProxy;
|
use yazi_proxy::ManagerProxy;
|
||||||
use yazi_shared::{event::{Cmd, Data}, fs::{File, FilesOp, Url, expand_path}};
|
use yazi_shared::{event::CmdCow, fs::{File, FilesOp, Url, expand_path}};
|
||||||
|
|
||||||
use crate::tab::Tab;
|
use crate::tab::Tab;
|
||||||
|
|
||||||
|
|
@ -7,9 +7,9 @@ struct Opt {
|
||||||
target: Url,
|
target: Url,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<Cmd> for Opt {
|
impl From<CmdCow> for Opt {
|
||||||
fn from(mut c: Cmd) -> Self {
|
fn from(mut c: CmdCow) -> Self {
|
||||||
let mut target = c.take_first().and_then(Data::into_url).unwrap_or_default();
|
let mut target = c.take_first_url().unwrap_or_default();
|
||||||
if target.is_regular() {
|
if target.is_regular() {
|
||||||
target = Url::from(expand_path(&target));
|
target = Url::from(expand_path(&target));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
use std::{mem, time::Duration};
|
use std::{borrow::Cow, mem, time::Duration};
|
||||||
|
|
||||||
use tokio::pin;
|
use tokio::pin;
|
||||||
use tokio_stream::{StreamExt, wrappers::UnboundedReceiverStream};
|
use tokio_stream::{StreamExt, wrappers::UnboundedReceiverStream};
|
||||||
|
|
@ -29,7 +29,7 @@ impl Tab {
|
||||||
InputProxy::show(InputCfg::search(&opt.via.to_string()).with_value(opt.subject));
|
InputProxy::show(InputCfg::search(&opt.via.to_string()).with_value(opt.subject));
|
||||||
|
|
||||||
if let Some(Ok(subject)) = input.recv().await {
|
if let Some(Ok(subject)) = input.recv().await {
|
||||||
opt.subject = subject;
|
opt.subject = Cow::Owned(subject);
|
||||||
TabProxy::search_do(opt);
|
TabProxy::search_do(opt);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -52,14 +52,14 @@ impl Tab {
|
||||||
external::rg(external::RgOpt {
|
external::rg(external::RgOpt {
|
||||||
cwd: cwd.clone(),
|
cwd: cwd.clone(),
|
||||||
hidden,
|
hidden,
|
||||||
subject: opt.subject,
|
subject: opt.subject.into_owned(),
|
||||||
args: opt.args,
|
args: opt.args,
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
external::fd(external::FdOpt {
|
external::fd(external::FdOpt {
|
||||||
cwd: cwd.clone(),
|
cwd: cwd.clone(),
|
||||||
hidden,
|
hidden,
|
||||||
subject: opt.subject,
|
subject: opt.subject.into_owned(),
|
||||||
args: opt.args,
|
args: opt.args,
|
||||||
})
|
})
|
||||||
}?;
|
}?;
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,13 @@
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
use yazi_shared::event::Cmd;
|
use yazi_shared::event::CmdCow;
|
||||||
|
|
||||||
use crate::tab::Tab;
|
use crate::tab::Tab;
|
||||||
|
|
||||||
struct Opt;
|
struct Opt;
|
||||||
|
|
||||||
impl From<Cmd> for Opt {
|
impl From<CmdCow> for Opt {
|
||||||
fn from(_: Cmd) -> Self { Self }
|
fn from(_: CmdCow) -> Self { Self }
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<()> for Opt {
|
impl From<()> for Opt {
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
use yazi_shared::event::Cmd;
|
use yazi_shared::event::CmdCow;
|
||||||
|
|
||||||
use crate::tab::Tab;
|
use crate::tab::Tab;
|
||||||
|
|
||||||
struct Opt;
|
struct Opt;
|
||||||
|
|
||||||
impl From<Cmd> for Opt {
|
impl From<CmdCow> for Opt {
|
||||||
fn from(_: Cmd) -> Self { Self }
|
fn from(_: CmdCow) -> Self { Self }
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Tab {
|
impl Tab {
|
||||||
|
|
|
||||||
|
|
@ -3,12 +3,12 @@ use std::{borrow::Cow, fmt::Display};
|
||||||
use anyhow::bail;
|
use anyhow::bail;
|
||||||
use yazi_config::{open::Opener, popup::InputCfg};
|
use yazi_config::{open::Opener, popup::InputCfg};
|
||||||
use yazi_proxy::{AppProxy, InputProxy, TasksProxy};
|
use yazi_proxy::{AppProxy, InputProxy, TasksProxy};
|
||||||
use yazi_shared::event::{Cmd, Data};
|
use yazi_shared::event::{CmdCow, Data};
|
||||||
|
|
||||||
use crate::tab::Tab;
|
use crate::tab::Tab;
|
||||||
|
|
||||||
pub struct Opt {
|
pub struct Opt {
|
||||||
run: String,
|
run: Cow<'static, str>,
|
||||||
block: bool,
|
block: bool,
|
||||||
orphan: bool,
|
orphan: bool,
|
||||||
confirm: bool,
|
confirm: bool,
|
||||||
|
|
@ -16,10 +16,10 @@ pub struct Opt {
|
||||||
cursor: Option<usize>,
|
cursor: Option<usize>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl TryFrom<Cmd> for Opt {
|
impl TryFrom<CmdCow> for Opt {
|
||||||
type Error = anyhow::Error;
|
type Error = anyhow::Error;
|
||||||
|
|
||||||
fn try_from(mut c: Cmd) -> Result<Self, Self::Error> {
|
fn try_from(mut c: CmdCow) -> Result<Self, Self::Error> {
|
||||||
let me = Self {
|
let me = Self {
|
||||||
run: c.take_first_str().unwrap_or_default(),
|
run: c.take_first_str().unwrap_or_default(),
|
||||||
block: c.bool("block"),
|
block: c.bool("block"),
|
||||||
|
|
@ -71,7 +71,7 @@ Please replace e.g. `shell` with `shell --interactive`, `shell "my-template"` wi
|
||||||
let mut result =
|
let mut result =
|
||||||
InputProxy::show(InputCfg::shell(opt.block).with_value(opt.run).with_cursor(opt.cursor));
|
InputProxy::show(InputCfg::shell(opt.block).with_value(opt.run).with_cursor(opt.cursor));
|
||||||
match result.recv().await {
|
match result.recv().await {
|
||||||
Some(Ok(e)) => opt.run = e,
|
Some(Ok(e)) => opt.run = Cow::Owned(e),
|
||||||
_ => return,
|
_ => return,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -79,7 +79,7 @@ Please replace e.g. `shell` with `shell --interactive`, `shell "my-template"` wi
|
||||||
TasksProxy::open_with(
|
TasksProxy::open_with(
|
||||||
selected,
|
selected,
|
||||||
Cow::Owned(Opener {
|
Cow::Owned(Opener {
|
||||||
run: opt.run,
|
run: opt.run.into_owned(),
|
||||||
block: opt.block,
|
block: opt.block,
|
||||||
orphan: opt.orphan,
|
orphan: opt.orphan,
|
||||||
desc: Default::default(),
|
desc: Default::default(),
|
||||||
|
|
|
||||||
|
|
@ -2,12 +2,12 @@ use std::str::FromStr;
|
||||||
|
|
||||||
use yazi_config::manager::SortBy;
|
use yazi_config::manager::SortBy;
|
||||||
use yazi_proxy::ManagerProxy;
|
use yazi_proxy::ManagerProxy;
|
||||||
use yazi_shared::event::Cmd;
|
use yazi_shared::event::CmdCow;
|
||||||
|
|
||||||
use crate::{tab::Tab, tasks::Tasks};
|
use crate::{tab::Tab, tasks::Tasks};
|
||||||
|
|
||||||
impl Tab {
|
impl Tab {
|
||||||
pub fn sort(&mut self, mut c: Cmd, tasks: &Tasks) {
|
pub fn sort(&mut self, mut c: CmdCow, tasks: &Tasks) {
|
||||||
let pref = &mut self.pref;
|
let pref = &mut self.pref;
|
||||||
if let Some(by) = c.take_first_str() {
|
if let Some(by) = c.take_first_str() {
|
||||||
pref.sort_by = SortBy::from_str(&by).unwrap_or_default();
|
pref.sort_by = SortBy::from_str(&by).unwrap_or_default();
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
use yazi_macro::render_and;
|
use yazi_macro::render_and;
|
||||||
use yazi_proxy::AppProxy;
|
use yazi_proxy::AppProxy;
|
||||||
use yazi_shared::event::Cmd;
|
use yazi_shared::event::CmdCow;
|
||||||
|
|
||||||
use crate::tab::Tab;
|
use crate::tab::Tab;
|
||||||
|
|
||||||
|
|
@ -8,8 +8,8 @@ struct Opt {
|
||||||
state: Option<bool>,
|
state: Option<bool>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<Cmd> for Opt {
|
impl From<CmdCow> for Opt {
|
||||||
fn from(mut c: Cmd) -> Self {
|
fn from(mut c: CmdCow) -> Self {
|
||||||
Self {
|
Self {
|
||||||
state: match c.take_first_str().as_deref() {
|
state: match c.take_first_str().as_deref() {
|
||||||
Some("on") => Some(true),
|
Some("on") => Some(true),
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
use yazi_macro::render;
|
use yazi_macro::render;
|
||||||
use yazi_proxy::AppProxy;
|
use yazi_proxy::AppProxy;
|
||||||
use yazi_shared::event::Cmd;
|
use yazi_shared::event::CmdCow;
|
||||||
|
|
||||||
use crate::tab::Tab;
|
use crate::tab::Tab;
|
||||||
|
|
||||||
|
|
@ -8,8 +8,8 @@ struct Opt {
|
||||||
state: Option<bool>,
|
state: Option<bool>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<Cmd> for Opt {
|
impl From<CmdCow> for Opt {
|
||||||
fn from(mut c: Cmd) -> Self {
|
fn from(mut c: CmdCow) -> Self {
|
||||||
Self {
|
Self {
|
||||||
state: match c.take_first_str().as_deref() {
|
state: match c.take_first_str().as_deref() {
|
||||||
Some("on") => Some(true),
|
Some("on") => Some(true),
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
use yazi_macro::render;
|
use yazi_macro::render;
|
||||||
use yazi_plugin::utils::PreviewLock;
|
use yazi_plugin::utils::PreviewLock;
|
||||||
use yazi_shared::event::Cmd;
|
use yazi_shared::event::CmdCow;
|
||||||
|
|
||||||
use crate::tab::Tab;
|
use crate::tab::Tab;
|
||||||
|
|
||||||
|
|
@ -8,10 +8,10 @@ pub struct Opt {
|
||||||
lock: PreviewLock,
|
lock: PreviewLock,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl TryFrom<Cmd> for Opt {
|
impl TryFrom<CmdCow> for Opt {
|
||||||
type Error = ();
|
type Error = ();
|
||||||
|
|
||||||
fn try_from(mut c: Cmd) -> Result<Self, Self::Error> {
|
fn try_from(mut c: CmdCow) -> Result<Self, Self::Error> {
|
||||||
Ok(Self { lock: c.take_any("lock").ok_or(())? })
|
Ok(Self { lock: c.take_any("lock").ok_or(())? })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
use yazi_macro::render;
|
use yazi_macro::render;
|
||||||
use yazi_plugin::utils::SpotLock;
|
use yazi_plugin::utils::SpotLock;
|
||||||
use yazi_shared::event::Cmd;
|
use yazi_shared::event::CmdCow;
|
||||||
|
|
||||||
use crate::tab::Tab;
|
use crate::tab::Tab;
|
||||||
|
|
||||||
|
|
@ -8,10 +8,10 @@ pub struct Opt {
|
||||||
lock: SpotLock,
|
lock: SpotLock,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl TryFrom<Cmd> for Opt {
|
impl TryFrom<CmdCow> for Opt {
|
||||||
type Error = ();
|
type Error = ();
|
||||||
|
|
||||||
fn try_from(mut c: Cmd) -> Result<Self, Self::Error> {
|
fn try_from(mut c: CmdCow) -> Result<Self, Self::Error> {
|
||||||
Ok(Self { lock: c.take_any("lock").ok_or(())? })
|
Ok(Self { lock: c.take_any("lock").ok_or(())? })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
use std::collections::BTreeSet;
|
use std::collections::BTreeSet;
|
||||||
|
|
||||||
use yazi_macro::render;
|
use yazi_macro::render;
|
||||||
use yazi_shared::event::Cmd;
|
use yazi_shared::event::CmdCow;
|
||||||
|
|
||||||
use crate::tab::{Mode, Tab};
|
use crate::tab::{Mode, Tab};
|
||||||
|
|
||||||
|
|
@ -9,8 +9,8 @@ struct Opt {
|
||||||
unset: bool,
|
unset: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<Cmd> for Opt {
|
impl From<CmdCow> for Opt {
|
||||||
fn from(c: Cmd) -> Self { Self { unset: c.bool("unset") } }
|
fn from(c: CmdCow) -> Self { Self { unset: c.bool("unset") } }
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Tab {
|
impl Tab {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
use yazi_macro::render;
|
use yazi_macro::render;
|
||||||
use yazi_shared::event::{Cmd, Data};
|
use yazi_shared::event::{CmdCow, Data};
|
||||||
|
|
||||||
use crate::tasks::Tasks;
|
use crate::tasks::Tasks;
|
||||||
|
|
||||||
|
|
@ -7,8 +7,8 @@ struct Opt {
|
||||||
step: isize,
|
step: isize,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<Cmd> for Opt {
|
impl From<CmdCow> for Opt {
|
||||||
fn from(c: Cmd) -> Self { Self { step: c.first().and_then(Data::as_isize).unwrap_or(0) } }
|
fn from(c: CmdCow) -> Self { Self { step: c.first().and_then(Data::as_isize).unwrap_or(0) } }
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<isize> for Opt {
|
impl From<isize> for Opt {
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
use yazi_macro::render;
|
use yazi_macro::render;
|
||||||
use yazi_shared::event::Cmd;
|
use yazi_shared::event::CmdCow;
|
||||||
|
|
||||||
use crate::tasks::Tasks;
|
use crate::tasks::Tasks;
|
||||||
|
|
||||||
impl Tasks {
|
impl Tasks {
|
||||||
pub fn cancel(&mut self, _: Cmd) {
|
pub fn cancel(&mut self, _: CmdCow) {
|
||||||
let id = self.ongoing().lock().get_id(self.cursor);
|
let id = self.ongoing().lock().get_id(self.cursor);
|
||||||
if id.map(|id| self.scheduler.cancel(id)) != Some(true) {
|
if id.map(|id| self.scheduler.cancel(id)) != Some(true) {
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -4,12 +4,12 @@ use crossterm::terminal::{disable_raw_mode, enable_raw_mode};
|
||||||
use scopeguard::defer;
|
use scopeguard::defer;
|
||||||
use tokio::{io::{AsyncReadExt, stdin}, select, sync::mpsc, time};
|
use tokio::{io::{AsyncReadExt, stdin}, select, sync::mpsc, time};
|
||||||
use yazi_proxy::{AppProxy, HIDER};
|
use yazi_proxy::{AppProxy, HIDER};
|
||||||
use yazi_shared::{event::Cmd, terminal_clear};
|
use yazi_shared::{event::CmdCow, terminal_clear};
|
||||||
|
|
||||||
use crate::tasks::Tasks;
|
use crate::tasks::Tasks;
|
||||||
|
|
||||||
impl Tasks {
|
impl Tasks {
|
||||||
pub fn inspect(&self, _: Cmd) {
|
pub fn inspect(&self, _: CmdCow) {
|
||||||
let ongoing = self.ongoing().clone();
|
let ongoing = self.ongoing().clone();
|
||||||
let Some(id) = ongoing.lock().get_id(self.cursor) else {
|
let Some(id) = ongoing.lock().get_id(self.cursor) else {
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
use yazi_macro::render;
|
use yazi_macro::render;
|
||||||
use yazi_shared::event::Cmd;
|
use yazi_shared::event::CmdCow;
|
||||||
|
|
||||||
use crate::tasks::Tasks;
|
use crate::tasks::Tasks;
|
||||||
|
|
||||||
struct Opt;
|
struct Opt;
|
||||||
|
|
||||||
impl From<Cmd> for Opt {
|
impl From<CmdCow> for Opt {
|
||||||
fn from(_: Cmd) -> Self { Self }
|
fn from(_: CmdCow) -> Self { Self }
|
||||||
}
|
}
|
||||||
impl From<()> for Opt {
|
impl From<()> for Opt {
|
||||||
fn from(_: ()) -> Self { Self }
|
fn from(_: ()) -> Self { Self }
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
use tokio::sync::mpsc;
|
use tokio::sync::mpsc;
|
||||||
use tracing::error;
|
use tracing::error;
|
||||||
use yazi_shared::event::{Cmd, Data};
|
use yazi_shared::event::{CmdCow, Data};
|
||||||
|
|
||||||
use crate::which::Which;
|
use crate::which::Which;
|
||||||
|
|
||||||
|
|
@ -9,10 +9,10 @@ pub struct Opt {
|
||||||
idx: usize,
|
idx: usize,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl TryFrom<Cmd> for Opt {
|
impl TryFrom<CmdCow> for Opt {
|
||||||
type Error = ();
|
type Error = ();
|
||||||
|
|
||||||
fn try_from(mut c: Cmd) -> Result<Self, Self::Error> {
|
fn try_from(mut c: CmdCow) -> Result<Self, Self::Error> {
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
tx: c.take_any("tx").ok_or(())?,
|
tx: c.take_any("tx").ok_or(())?,
|
||||||
idx: c.first().and_then(Data::as_usize).ok_or(())?,
|
idx: c.first().and_then(Data::as_usize).ok_or(())?,
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ use std::str::FromStr;
|
||||||
|
|
||||||
use yazi_config::{KEYMAP, keymap::{Chord, Key}};
|
use yazi_config::{KEYMAP, keymap::{Chord, Key}};
|
||||||
use yazi_macro::render;
|
use yazi_macro::render;
|
||||||
use yazi_shared::{Layer, event::Cmd};
|
use yazi_shared::{Layer, event::CmdCow};
|
||||||
|
|
||||||
use crate::which::{Which, WhichSorter};
|
use crate::which::{Which, WhichSorter};
|
||||||
|
|
||||||
|
|
@ -12,10 +12,10 @@ pub struct Opt {
|
||||||
silent: bool,
|
silent: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl TryFrom<Cmd> for Opt {
|
impl TryFrom<CmdCow> for Opt {
|
||||||
type Error = anyhow::Error;
|
type Error = anyhow::Error;
|
||||||
|
|
||||||
fn try_from(mut c: Cmd) -> Result<Self, Self::Error> {
|
fn try_from(mut c: CmdCow) -> Result<Self, Self::Error> {
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
cands: c.take_any("candidates").unwrap_or_default(),
|
cands: c.take_any("candidates").unwrap_or_default(),
|
||||||
layer: Layer::from_str(&c.take_str("layer").unwrap_or_default())?,
|
layer: Layer::from_str(&c.take_str("layer").unwrap_or_default())?,
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ use crossterm::event::KeyEvent;
|
||||||
use yazi_config::keymap::Key;
|
use yazi_config::keymap::Key;
|
||||||
use yazi_core::input::InputMode;
|
use yazi_core::input::InputMode;
|
||||||
use yazi_macro::emit;
|
use yazi_macro::emit;
|
||||||
use yazi_shared::{Layer, event::{Cmd, Event, NEED_RENDER}};
|
use yazi_shared::{Layer, event::{CmdCow, Event, NEED_RENDER}};
|
||||||
|
|
||||||
use crate::{Ctx, Executor, Router, Signals, Term, lives::Lives};
|
use crate::{Ctx, Executor, Router, Signals, Term, lives::Lives};
|
||||||
|
|
||||||
|
|
@ -66,10 +66,12 @@ impl App {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn dispatch_call(&mut self, cmd: Cmd, layer: Layer) { Executor::new(self).execute(cmd, layer); }
|
fn dispatch_call(&mut self, cmd: CmdCow, layer: Layer) {
|
||||||
|
Executor::new(self).execute(cmd, layer);
|
||||||
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn dispatch_seq(&mut self, mut cmds: VecDeque<Cmd>, layer: Layer) {
|
fn dispatch_seq(&mut self, mut cmds: VecDeque<CmdCow>, layer: Layer) {
|
||||||
if let Some(cmd) = cmds.pop_front() {
|
if let Some(cmd) = cmds.pop_front() {
|
||||||
Executor::new(self).execute(cmd, layer);
|
Executor::new(self).execute(cmd, layer);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,12 +2,12 @@ use mlua::IntoLua;
|
||||||
use tracing::error;
|
use tracing::error;
|
||||||
use yazi_dds::{LOCAL, Payload, REMOTE};
|
use yazi_dds::{LOCAL, Payload, REMOTE};
|
||||||
use yazi_plugin::LUA;
|
use yazi_plugin::LUA;
|
||||||
use yazi_shared::event::Cmd;
|
use yazi_shared::event::CmdCow;
|
||||||
|
|
||||||
use crate::{app::App, lives::Lives};
|
use crate::{app::App, lives::Lives};
|
||||||
|
|
||||||
impl App {
|
impl App {
|
||||||
pub(crate) fn accept_payload(&mut self, mut cmd: Cmd) {
|
pub(crate) fn accept_payload(&mut self, mut cmd: CmdCow) {
|
||||||
let Some(payload) = cmd.take_any::<Payload>("payload") else {
|
let Some(payload) = cmd.take_any::<Payload>("payload") else {
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -17,13 +17,13 @@ impl App {
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut hits = false;
|
let mut hits = false;
|
||||||
if let Some(chunk) = LOADER.read().get(&opt.id) {
|
if let Some(chunk) = LOADER.read().get(opt.id.as_ref()) {
|
||||||
hits = true;
|
hits = true;
|
||||||
opt.mode = opt.mode.auto_then(chunk.sync_entry);
|
opt.mode = opt.mode.auto_then(chunk.sync_entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
if opt.mode == PluginMode::Async {
|
if opt.mode == PluginMode::Async {
|
||||||
return self.cx.tasks.plugin_micro(opt.id, opt.args);
|
return self.cx.tasks.plugin_micro(opt.id.into_owned(), opt.args);
|
||||||
} else if opt.mode == PluginMode::Sync && hits {
|
} else if opt.mode == PluginMode::Sync && hits {
|
||||||
return self.plugin_do(opt);
|
return self.plugin_do(opt);
|
||||||
}
|
}
|
||||||
|
|
@ -42,12 +42,12 @@ impl App {
|
||||||
};
|
};
|
||||||
|
|
||||||
let loader = LOADER.read();
|
let loader = LOADER.read();
|
||||||
let Some(chunk) = loader.get(&opt.id) else {
|
let Some(chunk) = loader.get(opt.id.as_ref()) else {
|
||||||
return warn!("plugin `{}` not found", opt.id);
|
return warn!("plugin `{}` not found", opt.id);
|
||||||
};
|
};
|
||||||
|
|
||||||
if opt.mode.auto_then(chunk.sync_entry) != PluginMode::Sync {
|
if opt.mode.auto_then(chunk.sync_entry) != PluginMode::Sync {
|
||||||
return self.cx.tasks.plugin_micro(opt.id, opt.args);
|
return self.cx.tasks.plugin_micro(opt.id.into_owned(), opt.args);
|
||||||
}
|
}
|
||||||
|
|
||||||
match LUA.named_registry_value::<RtRef>("rt") {
|
match LUA.named_registry_value::<RtRef>("rt") {
|
||||||
|
|
|
||||||
|
|
@ -3,14 +3,14 @@ use ratatui::layout::Position;
|
||||||
use tracing::error;
|
use tracing::error;
|
||||||
use yazi_config::LAYOUT;
|
use yazi_config::LAYOUT;
|
||||||
use yazi_macro::render;
|
use yazi_macro::render;
|
||||||
use yazi_shared::event::Cmd;
|
use yazi_shared::event::CmdCow;
|
||||||
|
|
||||||
use crate::{Root, app::App, lives::Lives};
|
use crate::{Root, app::App, lives::Lives};
|
||||||
|
|
||||||
struct Opt;
|
struct Opt;
|
||||||
|
|
||||||
impl From<Cmd> for Opt {
|
impl From<CmdCow> for Opt {
|
||||||
fn from(_: Cmd) -> Self { Self }
|
fn from(_: CmdCow) -> Self { Self }
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<()> for Opt {
|
impl From<()> for Opt {
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
use yazi_shared::event::Cmd;
|
use yazi_shared::event::CmdCow;
|
||||||
|
|
||||||
use crate::app::App;
|
use crate::app::App;
|
||||||
|
|
||||||
struct Opt;
|
struct Opt;
|
||||||
|
|
||||||
impl From<Cmd> for Opt {
|
impl From<CmdCow> for Opt {
|
||||||
fn from(_: Cmd) -> Self { Self }
|
fn from(_: CmdCow) -> Self { Self }
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<()> for Opt {
|
impl From<()> for Opt {
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
use yazi_shared::event::Cmd;
|
use yazi_shared::event::CmdCow;
|
||||||
|
|
||||||
use crate::{Term, app::App};
|
use crate::{Term, app::App};
|
||||||
|
|
||||||
impl App {
|
impl App {
|
||||||
pub(crate) fn resume(&mut self, _: Cmd) {
|
pub(crate) fn resume(&mut self, _: CmdCow) {
|
||||||
self.cx.active_mut().preview.reset_image();
|
self.cx.active_mut().preview.reset_image();
|
||||||
self.term = Some(Term::start().unwrap());
|
self.term = Some(Term::start().unwrap());
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
use tokio::sync::oneshot;
|
use tokio::sync::oneshot;
|
||||||
use yazi_shared::event::Cmd;
|
use yazi_shared::event::CmdCow;
|
||||||
|
|
||||||
use crate::app::App;
|
use crate::app::App;
|
||||||
|
|
||||||
|
|
@ -7,8 +7,8 @@ struct Opt {
|
||||||
tx: Option<oneshot::Sender<()>>,
|
tx: Option<oneshot::Sender<()>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<Cmd> for Opt {
|
impl From<CmdCow> for Opt {
|
||||||
fn from(mut c: Cmd) -> Self { Self { tx: c.take_any("tx") } }
|
fn from(mut c: CmdCow) -> Self { Self { tx: c.take_any("tx") } }
|
||||||
}
|
}
|
||||||
|
|
||||||
impl App {
|
impl App {
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue