mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
fix: incorrect $0 and $@ parameters in shell command under empty directories
This commit is contained in:
parent
4d39194cd8
commit
27170ce70b
3 changed files with 11 additions and 3 deletions
|
|
@ -1,5 +1,3 @@
|
||||||
use std::iter;
|
|
||||||
|
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use ratatui::layout::Rect;
|
use ratatui::layout::Rect;
|
||||||
use tokio::task::JoinHandle;
|
use tokio::task::JoinHandle;
|
||||||
|
|
@ -96,7 +94,9 @@ impl Tab {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn hovered_and_selected(&self) -> Box<dyn Iterator<Item = &UrlBuf> + '_> {
|
pub fn hovered_and_selected(&self) -> Box<dyn Iterator<Item = &UrlBuf> + '_> {
|
||||||
let Some(h) = self.hovered() else { return Box::new(iter::empty()) };
|
let Some(h) = self.hovered() else {
|
||||||
|
return Box::new([UrlBuf::new()].into_iter().chain(self.selected.values()));
|
||||||
|
};
|
||||||
if self.selected.is_empty() {
|
if self.selected.is_empty() {
|
||||||
Box::new([&h.url, &h.url].into_iter())
|
Box::new([&h.url, &h.url].into_iter())
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -84,6 +84,8 @@ impl LocBuf {
|
||||||
Ok(Self { inner: loc.inner, uri, urn })
|
Ok(Self { inner: loc.inner, uri, urn })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub const fn empty() -> Self { Self { inner: PathBuf::new(), uri: 0, urn: 0 } }
|
||||||
|
|
||||||
pub fn zeroed(path: impl Into<PathBuf>) -> Self {
|
pub fn zeroed(path: impl Into<PathBuf>) -> Self {
|
||||||
let loc = Self::from(path.into());
|
let loc = Self::from(path.into());
|
||||||
let Loc { inner, uri, urn } = Loc::zeroed(&loc.inner);
|
let Loc { inner, uri, urn } = Loc::zeroed(&loc.inner);
|
||||||
|
|
|
||||||
|
|
@ -79,6 +79,12 @@ impl PartialEq<Url<'_>> for &UrlBuf {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl UrlBuf {
|
impl UrlBuf {
|
||||||
|
#[inline]
|
||||||
|
pub const fn new() -> &'static Self {
|
||||||
|
static U: UrlBuf = UrlBuf { loc: LocBuf::empty(), scheme: Scheme::Regular };
|
||||||
|
&U
|
||||||
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn join(&self, path: impl AsRef<Path>) -> Self { self.as_url().join(path) }
|
pub fn join(&self, path: impl AsRef<Path>) -> Self { self.as_url().join(path) }
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue