mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 00:31:04 +00:00
27 lines
624 B
Rust
27 lines
624 B
Rust
use anyhow::Result;
|
|
use yazi_macro::succ;
|
|
use yazi_parser::mgr::UpdatePagedOpt;
|
|
use yazi_shared::event::Data;
|
|
|
|
use crate::{Actor, Ctx};
|
|
|
|
pub struct UpdatePaged;
|
|
|
|
impl Actor for UpdatePaged {
|
|
type Options = UpdatePagedOpt;
|
|
|
|
const NAME: &str = "update_paged";
|
|
|
|
fn act(cx: &mut Ctx, opt: Self::Options) -> Result<Data> {
|
|
if opt.only_if.is_some_and(|u| u != *cx.cwd()) {
|
|
succ!();
|
|
}
|
|
|
|
let targets = cx.current().paginate(opt.page.unwrap_or(cx.current().page));
|
|
if !targets.is_empty() {
|
|
cx.tasks().fetch_paged(targets, &cx.mgr.mimetype);
|
|
cx.tasks().preload_paged(targets, &cx.mgr.mimetype);
|
|
}
|
|
succ!();
|
|
}
|
|
}
|