diff --git a/yazi-actor/src/mgr/cd.rs b/yazi-actor/src/mgr/cd.rs index 96c04e5a..c94fb35b 100644 --- a/yazi-actor/src/mgr/cd.rs +++ b/yazi-actor/src/mgr/cd.rs @@ -61,6 +61,7 @@ impl Actor for Cd { err!(Pubsub::pub_after_cd(tab.id, tab.cwd())); act!(mgr:hidden, cx)?; act!(mgr:sort, cx)?; + act!(mgr:hover, cx)?; act!(mgr:refresh, cx)?; succ!(render!()); } diff --git a/yazi-actor/src/mgr/hidden.rs b/yazi-actor/src/mgr/hidden.rs index c321b76d..5336bed3 100644 --- a/yazi-actor/src/mgr/hidden.rs +++ b/yazi-actor/src/mgr/hidden.rs @@ -1,7 +1,7 @@ use anyhow::Result; use yazi_core::tab::Folder; use yazi_fs::FolderStage; -use yazi_macro::{act, render}; +use yazi_macro::{act, render, render_and, succ}; use yazi_parser::mgr::HiddenOpt; use yazi_shared::event::Data; @@ -22,32 +22,32 @@ impl Actor for Hidden { let apply = |f: &mut Folder| { if f.stage == FolderStage::Loading { render!(); + false } else { f.files.set_show_hidden(state); - render!(f.files.catchup_revision()); + render_and!(f.files.catchup_revision()) } }; // Apply to CWD and parent - apply(cx.current_mut()); - cx.parent_mut().map(apply); - - // Repos CWD and parent - act!(mgr:hover, cx)?; - - // Apply to and repos hovered folder - if let Some(h) = cx.hovered_folder_mut() { - apply(h); - render!(h.repos(None)); + if let (a, Some(b)) = (apply(cx.current_mut()), cx.parent_mut().map(apply)) + && (a | b) + { + act!(mgr:hover, cx)?; + act!(mgr:update_paged, cx)?; } - if hovered.as_ref() != cx.hovered().map(|f| &f.url) { + // Apply to hovered + if let Some(h) = cx.hovered_folder_mut() + && apply(h) + { + render!(h.repos(None)); + act!(mgr:peek, cx, true)?; + } else if hovered.as_ref() != cx.hovered().map(|f| &f.url) { act!(mgr:peek, cx)?; act!(mgr:watch, cx)?; - } else if cx.hovered().is_some_and(|f| f.is_dir()) { - act!(mgr:peek, cx, true)?; } - act!(mgr:update_paged, cx) + succ!() } } diff --git a/yazi-actor/src/mgr/refresh.rs b/yazi-actor/src/mgr/refresh.rs index a46711da..69b79196 100644 --- a/yazi-actor/src/mgr/refresh.rs +++ b/yazi-actor/src/mgr/refresh.rs @@ -21,8 +21,6 @@ impl Actor for Refresh { execute!(TTY.writer(), SetTitle(s)).ok(); } - // cx.tab_mut().apply_files_attrs(); - if let Some(p) = cx.parent() { cx.mgr.watcher.trigger_dirs(&[cx.current(), p]); } else { diff --git a/yazi-actor/src/mgr/sort.rs b/yazi-actor/src/mgr/sort.rs index afe1ed50..02147abf 100644 --- a/yazi-actor/src/mgr/sort.rs +++ b/yazi-actor/src/mgr/sort.rs @@ -1,7 +1,7 @@ use anyhow::Result; use yazi_core::tab::Folder; use yazi_fs::{FilesSorter, FolderStage}; -use yazi_macro::{act, render, succ}; +use yazi_macro::{act, render, render_and, succ}; use yazi_parser::mgr::SortOpt; use yazi_shared::event::Data; @@ -27,33 +27,33 @@ impl Actor for Sort { let apply = |f: &mut Folder| { if f.stage == FolderStage::Loading { render!(); + false } else { f.files.set_sorter(sorter); - render!(f.files.catchup_revision()); + render_and!(f.files.catchup_revision()) } }; // Apply to CWD and parent - apply(cx.current_mut()); - cx.parent_mut().map(apply); - - // Repos CWD and parent - act!(mgr:hover, cx)?; - - // Apply to and repos hovered folder - if let Some(h) = cx.hovered_folder_mut() { - apply(h); - render!(h.repos(None)); + if let (a, Some(b)) = (apply(cx.current_mut()), cx.parent_mut().map(apply)) + && (a | b) + { + act!(mgr:hover, cx)?; + act!(mgr:update_paged, cx)?; + cx.tasks.prework_sorted(&cx.mgr.tabs[cx.tab].current.files); } - if hovered.as_ref() != cx.hovered().map(|f| &f.url) { + // Apply to hovered + if let Some(h) = cx.hovered_folder_mut() + && apply(h) + { + render!(h.repos(None)); + act!(mgr:peek, cx, true)?; + } else if hovered.as_ref() != cx.hovered().map(|f| &f.url) { act!(mgr:peek, cx)?; act!(mgr:watch, cx)?; - } else if cx.hovered().is_some_and(|f| f.is_dir()) { - act!(mgr:peek, cx, true)?; } - act!(mgr:update_paged, cx)?; - succ!(cx.tasks.prework_sorted(&cx.mgr.tabs[cx.tab].current.files)); + succ!(); } } diff --git a/yazi-actor/src/mgr/update_files.rs b/yazi-actor/src/mgr/update_files.rs index f80295e7..a1abf60a 100644 --- a/yazi-actor/src/mgr/update_files.rs +++ b/yazi-actor/src/mgr/update_files.rs @@ -23,8 +23,8 @@ impl Actor for UpdateFiles { } render!(cx.mgr.yanked.catchup_revision(false)); - act!(mgr:sort, cx)?; act!(mgr:hidden, cx)?; + act!(mgr:sort, cx)?; if revision != cx.current().files.revision { act!(mgr:hover, cx)?;