mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
..
This commit is contained in:
parent
0ceb96c096
commit
62bf5e1660
5 changed files with 35 additions and 36 deletions
|
|
@ -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!());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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!()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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!();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)?;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue