Skip to content

Commit

Permalink
fix: pass through show_hidden when building default Files (#2057)
Browse files Browse the repository at this point in the history
  • Loading branch information
sxyazi authored Dec 16, 2024
1 parent f4eef99 commit c96b1d3
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
16 changes: 15 additions & 1 deletion yazi-core/src/tab/folder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ use yazi_fs::{Cha, File, Files, FilesOp, FolderStage, Step};
use yazi_proxy::ManagerProxy;
use yazi_shared::{Id, url::{Url, Urn}};

#[derive(Default)]
pub struct Folder {
pub url: Url,
pub cha: Cha,
Expand All @@ -20,6 +19,21 @@ pub struct Folder {
pub tracing: bool,
}

impl Default for Folder {
fn default() -> Self {
Self {
url: Default::default(),
cha: Default::default(),
files: Files::new(MANAGER.show_hidden),
stage: Default::default(),
offset: Default::default(),
cursor: Default::default(),
page: Default::default(),
tracing: Default::default(),
}
}
}

impl From<&Url> for Folder {
fn from(url: &Url) -> Self { Self { url: url.clone(), ..Default::default() } }
}
Expand Down
2 changes: 2 additions & 0 deletions yazi-fs/src/files.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ impl Deref for Files {
}

impl Files {
pub fn new(show_hidden: bool) -> Self { Self { show_hidden, ..Default::default() } }

pub async fn from_dir(dir: &Url) -> std::io::Result<UnboundedReceiver<File>> {
let mut it = fs::read_dir(dir).await?;
let (tx, rx) = mpsc::unbounded_channel();
Expand Down
1 change: 0 additions & 1 deletion yazi-plugin/preset/plugins/zoxide.lua
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ local function setup(_, opts)
function()
ya.manager_emit("shell", {
orphan = true,
confirm = true,
"zoxide add " .. ya.quote(tostring(cx.active.current.cwd)),
})
end
Expand Down

0 comments on commit c96b1d3

Please sign in to comment.