This commit is contained in:
sxyazi 2025-08-08 02:21:45 +08:00
parent 0ceb96c096
commit 62bf5e1660
No known key found for this signature in database
5 changed files with 35 additions and 36 deletions

View file

@ -61,6 +61,7 @@ impl Actor for Cd {
err!(Pubsub::pub_after_cd(tab.id, tab.cwd())); err!(Pubsub::pub_after_cd(tab.id, tab.cwd()));
act!(mgr:hidden, cx)?; act!(mgr:hidden, cx)?;
act!(mgr:sort, cx)?; act!(mgr:sort, cx)?;
act!(mgr:hover, cx)?;
act!(mgr:refresh, cx)?; act!(mgr:refresh, cx)?;
succ!(render!()); succ!(render!());
} }

View file

@ -1,7 +1,7 @@
use anyhow::Result; use anyhow::Result;
use yazi_core::tab::Folder; use yazi_core::tab::Folder;
use yazi_fs::FolderStage; use yazi_fs::FolderStage;
use yazi_macro::{act, render}; use yazi_macro::{act, render, render_and, succ};
use yazi_parser::mgr::HiddenOpt; use yazi_parser::mgr::HiddenOpt;
use yazi_shared::event::Data; use yazi_shared::event::Data;
@ -22,32 +22,32 @@ impl Actor for Hidden {
let apply = |f: &mut Folder| { let apply = |f: &mut Folder| {
if f.stage == FolderStage::Loading { if f.stage == FolderStage::Loading {
render!(); render!();
false
} else { } else {
f.files.set_show_hidden(state); f.files.set_show_hidden(state);
render!(f.files.catchup_revision()); render_and!(f.files.catchup_revision())
} }
}; };
// Apply to CWD and parent // Apply to CWD and parent
apply(cx.current_mut()); if let (a, Some(b)) = (apply(cx.current_mut()), cx.parent_mut().map(apply))
cx.parent_mut().map(apply); && (a | b)
{
// Repos CWD and parent act!(mgr:hover, cx)?;
act!(mgr:hover, cx)?; act!(mgr:update_paged, cx)?;
// Apply to and repos hovered folder
if let Some(h) = cx.hovered_folder_mut() {
apply(h);
render!(h.repos(None));
} }
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:peek, cx)?;
act!(mgr:watch, 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!()
} }
} }

View file

@ -21,8 +21,6 @@ impl Actor for Refresh {
execute!(TTY.writer(), SetTitle(s)).ok(); execute!(TTY.writer(), SetTitle(s)).ok();
} }
// cx.tab_mut().apply_files_attrs();
if let Some(p) = cx.parent() { if let Some(p) = cx.parent() {
cx.mgr.watcher.trigger_dirs(&[cx.current(), p]); cx.mgr.watcher.trigger_dirs(&[cx.current(), p]);
} else { } else {

View file

@ -1,7 +1,7 @@
use anyhow::Result; use anyhow::Result;
use yazi_core::tab::Folder; use yazi_core::tab::Folder;
use yazi_fs::{FilesSorter, FolderStage}; 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_parser::mgr::SortOpt;
use yazi_shared::event::Data; use yazi_shared::event::Data;
@ -27,33 +27,33 @@ impl Actor for Sort {
let apply = |f: &mut Folder| { let apply = |f: &mut Folder| {
if f.stage == FolderStage::Loading { if f.stage == FolderStage::Loading {
render!(); render!();
false
} else { } else {
f.files.set_sorter(sorter); f.files.set_sorter(sorter);
render!(f.files.catchup_revision()); render_and!(f.files.catchup_revision())
} }
}; };
// Apply to CWD and parent // Apply to CWD and parent
apply(cx.current_mut()); if let (a, Some(b)) = (apply(cx.current_mut()), cx.parent_mut().map(apply))
cx.parent_mut().map(apply); && (a | b)
{
// Repos CWD and parent act!(mgr:hover, cx)?;
act!(mgr:hover, cx)?; act!(mgr:update_paged, cx)?;
cx.tasks.prework_sorted(&cx.mgr.tabs[cx.tab].current.files);
// Apply to and repos hovered folder
if let Some(h) = cx.hovered_folder_mut() {
apply(h);
render!(h.repos(None));
} }
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:peek, cx)?;
act!(mgr:watch, 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!();
succ!(cx.tasks.prework_sorted(&cx.mgr.tabs[cx.tab].current.files));
} }
} }

View file

@ -23,8 +23,8 @@ impl Actor for UpdateFiles {
} }
render!(cx.mgr.yanked.catchup_revision(false)); render!(cx.mgr.yanked.catchup_revision(false));
act!(mgr:sort, cx)?;
act!(mgr:hidden, cx)?; act!(mgr:hidden, cx)?;
act!(mgr:sort, cx)?;
if revision != cx.current().files.revision { if revision != cx.current().files.revision {
act!(mgr:hover, cx)?; act!(mgr:hover, cx)?;