mirror of
https://github.com/sxyazi/yazi.git
synced 2024-12-19 23:01:36 +03:00
fix: show_hidden
not properly applied to hovered folder (#124)
This commit is contained in:
parent
fa64047120
commit
567c617b28
@ -30,7 +30,7 @@ impl Manager {
|
||||
pub fn refresh(&mut self) {
|
||||
env::set_current_dir(self.cwd()).ok();
|
||||
|
||||
self.active_mut().apply_show_hidden();
|
||||
self.active_mut().apply_show_hidden(false);
|
||||
|
||||
if let Some(f) = self.parent() {
|
||||
self.watcher.trigger_dirs(&[self.cwd(), &f.cwd]);
|
||||
@ -342,10 +342,13 @@ impl Manager {
|
||||
self.current_mut().update(op)
|
||||
} else if matches!(self.parent(), Some(p) if p.cwd == url) {
|
||||
self.active_mut().parent.as_mut().unwrap().update(op)
|
||||
} else if matches!(self.hovered(), Some(h) if h.url() == &url) {
|
||||
self.active_mut().history.entry(url.clone()).or_insert_with(|| Folder::from(&url));
|
||||
self.active_mut().apply_show_hidden(true);
|
||||
self.active_mut().history.get_mut(&url).unwrap().update(op)
|
||||
} else {
|
||||
self.active_mut().history.entry(url.clone()).or_insert_with(|| Folder::from(&url)).update(op);
|
||||
|
||||
matches!(self.hovered(), Some(h) if h.url() == &url)
|
||||
false
|
||||
};
|
||||
|
||||
b |= self.active_mut().parent.as_mut().map_or(false, |p| p.hover(&cwd));
|
||||
|
@ -422,28 +422,29 @@ impl Tab {
|
||||
}
|
||||
|
||||
self.show_hidden = state;
|
||||
self.apply_show_hidden();
|
||||
self.apply_show_hidden(false);
|
||||
true
|
||||
}
|
||||
|
||||
pub fn apply_show_hidden(&mut self) -> bool {
|
||||
pub fn apply_show_hidden(&mut self, only_hovered: bool) -> bool {
|
||||
let state = self.show_hidden;
|
||||
|
||||
let mut applied = false;
|
||||
applied |= self.current.files.set_show_hidden(state);
|
||||
|
||||
if let Some(parent) = self.parent.as_mut() {
|
||||
applied |= parent.files.set_show_hidden(state);
|
||||
}
|
||||
|
||||
applied |= match self.current.hovered {
|
||||
let mut b = match self.current.hovered {
|
||||
Some(ref h) if h.is_dir() => {
|
||||
self.history.get_mut(h.url()).map(|f| f.files.set_show_hidden(state)) == Some(true)
|
||||
}
|
||||
_ => false,
|
||||
};
|
||||
|
||||
if only_hovered {
|
||||
return b;
|
||||
}
|
||||
|
||||
b |= self.current.files.set_show_hidden(state);
|
||||
if let Some(parent) = self.parent.as_mut() {
|
||||
b |= parent.files.set_show_hidden(state);
|
||||
}
|
||||
|
||||
self.current.hover_repos();
|
||||
applied
|
||||
b
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user