Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: hidden attribute of files on Windows #632

Merged
merged 1 commit into from
Feb 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
128 changes: 83 additions & 45 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 23 additions & 0 deletions yazi-core/src/folder/files.rs
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ impl Files {
}
}

#[cfg(unix)]
pub fn update_deleting(&mut self, urls: Vec<Url>) {
if urls.is_empty() {
return;
Expand Down Expand Up @@ -266,6 +267,28 @@ impl Files {
}
}

#[cfg(windows)]
pub fn update_deleting(&mut self, urls: Vec<Url>) {
macro_rules! go {
($dist:expr, $src:expr) => {
let len = $dist.len();

$dist.retain(|f| !$src.remove(&f.url));
if $dist.len() != len {
self.revision += 1;
}
};
}

let mut urls: BTreeSet<_> = urls.into_iter().collect();
if !urls.is_empty() {
go!(self.items, urls);
}
if !urls.is_empty() {
go!(self.hidden, urls);
}
}

pub fn update_updating(
&mut self,
files: BTreeMap<Url, File>,
Expand Down
2 changes: 1 addition & 1 deletion yazi-core/src/manager/watcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ impl Watcher {

async fn on_changed(rx: UnboundedReceiver<Url>) {
// TODO: revert this once a new notification is implemented
let rx = UnboundedReceiverStream::new(rx).chunks_timeout(50, Duration::from_millis(20));
let rx = UnboundedReceiverStream::new(rx).chunks_timeout(100, Duration::from_millis(20));
pin!(rx);

while let Some(urls) = rx.next().await {
Expand Down
2 changes: 1 addition & 1 deletion yazi-core/src/tab/commands/reveal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ impl Tab {
};

self.cd(parent.clone());
FilesOp::Creating(parent, vec![File::from_dummy(opt.target.clone())]).emit();
FilesOp::Creating(parent, vec![File::from_dummy(&opt.target)]).emit();
Manager::_hover(Some(opt.target));
}
}
Loading
Loading