This commit is contained in:
sxyazi 2024-06-28 08:54:39 +08:00
parent b8cc2dcae8
commit 5e8b0ac1e9
No known key found for this signature in database
4 changed files with 8 additions and 5 deletions

View file

@ -113,7 +113,7 @@ previewers = [
{ mime = "application/pdf", run = "pdf" }, { mime = "application/pdf", run = "pdf" },
# Archive # Archive
{ mime = "application/{,g}zip", run = "archive" }, { mime = "application/{,g}zip", run = "archive" },
{ mime = "application/x-{tar,bzip*,7z-compressed,xz,rar}", run = "archive" }, { mime = "application/x-{tar,bzip*,7z-compressed,xz,rar,iso9660-image}", run = "archive" },
# Font # Font
{ mime = "font/*", run = "font" }, { mime = "font/*", run = "font" },
{ mime = "application/vnd.ms-opentype", run = "font" }, { mime = "application/vnd.ms-opentype", run = "font" },

View file

@ -27,10 +27,13 @@ impl Manager {
if !self.active_mut().try_escape_visual() { if !self.active_mut().try_escape_visual() {
return; return;
} }
let Some(hovered) = self.hovered().map(|h| &h.url) else {
return;
};
let mut opt = opt.into() as Opt; let mut opt = opt.into() as Opt;
opt.targets = if opt.hovered { opt.targets = if opt.hovered {
self.hovered().map(|h| vec![h.clone().url]).unwrap_or_default() vec![hovered.clone()]
} else { } else {
self.selected_or_hovered(false).cloned().collect() self.selected_or_hovered(false).cloned().collect()
}; };

View file

@ -10,8 +10,8 @@ use yazi_shared::{event::Cmd, fs::{maybe_exists, ok_or_not_found, paths_to_same_
use crate::manager::Manager; use crate::manager::Manager;
pub struct Opt { pub struct Opt {
force: bool,
hovered: bool, hovered: bool,
force: bool,
empty: String, empty: String,
cursor: String, cursor: String,
} }
@ -19,8 +19,8 @@ pub struct Opt {
impl From<Cmd> for Opt { impl From<Cmd> for Opt {
fn from(mut c: Cmd) -> Self { fn from(mut c: Cmd) -> Self {
Self { Self {
force: c.bool("force"),
hovered: c.bool("hovered"), hovered: c.bool("hovered"),
force: c.bool("force"),
empty: c.take_str("empty").unwrap_or_default(), empty: c.take_str("empty").unwrap_or_default(),
cursor: c.take_str("cursor").unwrap_or_default(), cursor: c.take_str("cursor").unwrap_or_default(),
} }

View file

@ -45,7 +45,7 @@ function M:peek()
if size > 0 then if size > 0 then
sizes[#sizes + 1] = ui.Line(string.format(" %s ", ya.readable_size(size))) sizes[#sizes + 1] = ui.Line(string.format(" %s ", ya.readable_size(size)))
else else
sizes[#sizes + 1] = ui.Line(" - ") sizes[#sizes + 1] = ui.Line("")
end end
::continue:: ::continue::