mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
fix: the parent does not hover properly on switching the hidden state (#339)
This commit is contained in:
parent
847c475d8c
commit
dcb4944974
2 changed files with 15 additions and 10 deletions
|
|
@ -93,6 +93,10 @@ impl Folder {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn hover(&mut self, url: &Url) -> bool {
|
pub fn hover(&mut self, url: &Url) -> bool {
|
||||||
|
if self.hovered().map(|h| &h.url) == Some(url) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
let new = self.files.position(url).unwrap_or(self.cursor);
|
let new = self.files.position(url).unwrap_or(self.cursor);
|
||||||
if new > self.cursor {
|
if new > self.cursor {
|
||||||
self.next(Step::next(new - self.cursor))
|
self.next(Step::next(new - self.cursor))
|
||||||
|
|
|
||||||
|
|
@ -100,28 +100,29 @@ impl Tab {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn apply_files_attrs(&mut self, just_preview: bool) -> bool {
|
pub fn apply_files_attrs(&mut self, just_preview: bool) -> bool {
|
||||||
|
let apply = |f: &mut Folder| {
|
||||||
|
let hovered = f.hovered().map(|h| h.url());
|
||||||
|
|
||||||
|
let mut b = f.files.set_show_hidden(self.conf.show_hidden);
|
||||||
|
b |= f.files.set_sorter(self.conf.sorter());
|
||||||
|
b | f.repos(hovered)
|
||||||
|
};
|
||||||
|
|
||||||
let mut b = false;
|
let mut b = false;
|
||||||
if let Some(f) =
|
if let Some(f) =
|
||||||
self.current.hovered().filter(|h| h.is_dir()).and_then(|h| self.history.get_mut(&h.url))
|
self.current.hovered().filter(|h| h.is_dir()).and_then(|h| self.history.get_mut(&h.url))
|
||||||
{
|
{
|
||||||
b |= f.files.set_show_hidden(self.conf.show_hidden);
|
b |= apply(f);
|
||||||
b |= f.files.set_sorter(self.conf.sorter());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if just_preview {
|
if just_preview {
|
||||||
return b;
|
return b;
|
||||||
}
|
}
|
||||||
|
|
||||||
let hovered = self.current.hovered().map(|h| h.url());
|
b |= apply(&mut self.current);
|
||||||
b |= self.current.files.set_show_hidden(self.conf.show_hidden);
|
|
||||||
b |= self.current.files.set_sorter(self.conf.sorter());
|
|
||||||
|
|
||||||
if let Some(parent) = self.parent.as_mut() {
|
if let Some(parent) = self.parent.as_mut() {
|
||||||
b |= parent.files.set_show_hidden(self.conf.show_hidden);
|
b |= apply(parent);
|
||||||
b |= parent.files.set_sorter(self.conf.sorter());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
self.current.repos(hovered);
|
|
||||||
b
|
b
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue