yazi_core/tab/commands/
find_arrow.rs

1use yazi_macro::render;
2use yazi_shared::event::CmdCow;
3
4use crate::tab::Tab;
5
6struct Opt {
7	prev: bool,
8}
9
10impl From<CmdCow> for Opt {
11	fn from(c: CmdCow) -> Self { Self { prev: c.bool("previous") } }
12}
13
14impl Tab {
15	#[yazi_codegen::command]
16	pub fn find_arrow(&mut self, opt: Opt) {
17		let Some(finder) = &mut self.finder else {
18			return;
19		};
20
21		render!(finder.catchup(&self.current.files));
22		if opt.prev {
23			finder.prev(&self.current.files, self.current.cursor, false).map(|s| self.arrow(s));
24		} else {
25			finder.next(&self.current.files, self.current.cursor, false).map(|s| self.arrow(s));
26		}
27	}
28}