-
Notifications
You must be signed in to change notification settings - Fork 458
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
76 changed files
with
839 additions
and
240 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
yazi_macro::mod_flat!(fetcher plugin preloader previewer); | ||
yazi_macro::mod_flat!(fetcher plugin preloader previewer spotter); | ||
|
||
pub const MAX_PREWORKERS: u8 = 32; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
use std::path::Path; | ||
|
||
use serde::Deserialize; | ||
use yazi_shared::{MIME_DIR, event::Cmd}; | ||
|
||
use crate::Pattern; | ||
|
||
#[derive(Debug, Deserialize)] | ||
pub struct Spotter { | ||
pub name: Option<Pattern>, | ||
pub mime: Option<Pattern>, | ||
pub run: Cmd, | ||
} | ||
|
||
impl Spotter { | ||
#[inline] | ||
pub fn matches(&self, path: &Path, mime: &str) -> bool { | ||
self.mime.as_ref().is_some_and(|p| p.match_mime(mime)) | ||
|| self.name.as_ref().is_some_and(|p| p.match_path(path, mime == MIME_DIR)) | ||
} | ||
|
||
#[inline] | ||
pub fn any_file(&self) -> bool { self.name.as_ref().is_some_and(|p| p.any_file()) } | ||
|
||
#[inline] | ||
pub fn any_dir(&self) -> bool { self.name.as_ref().is_some_and(|p| p.any_dir()) } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,7 @@ yazi_macro::mod_flat!( | |
remove | ||
rename | ||
seek | ||
spot | ||
suspend | ||
tab_close | ||
tab_create | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
use yazi_shared::event::{Cmd, Data}; | ||
|
||
use crate::spot::Spot; | ||
|
||
struct Opt { | ||
step: isize, | ||
} | ||
|
||
impl From<Cmd> for Opt { | ||
fn from(c: Cmd) -> Self { Self { step: c.first().and_then(Data::as_isize).unwrap_or(0) } } | ||
} | ||
|
||
impl Spot { | ||
#[yazi_codegen::command] | ||
pub fn arrow(&mut self, _: Opt) { | ||
todo!(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
use yazi_macro::render; | ||
use yazi_shared::event::Cmd; | ||
|
||
use crate::spot::Spot; | ||
|
||
struct Opt; | ||
|
||
impl From<Cmd> for Opt { | ||
fn from(_: Cmd) -> Self { Self } | ||
} | ||
impl From<()> for Opt { | ||
fn from(_: ()) -> Self { Self } | ||
} | ||
|
||
impl Spot { | ||
#[yazi_codegen::command] | ||
pub fn close(&mut self, _: Opt) { | ||
self.ct.take().map(|h| h.cancel()); | ||
render!(self.lock.take().is_some()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
yazi_macro::mod_flat!(arrow close); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
yazi_macro::mod_pub!(commands); | ||
|
||
yazi_macro::mod_flat!(spot); |
Oops, something went wrong.