yazi_core/tasks/commands/
toggle.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
use yazi_macro::render;
use yazi_shared::event::CmdCow;

use crate::tasks::Tasks;

struct Opt;

impl From<CmdCow> for Opt {
	fn from(_: CmdCow) -> Self { Self }
}
impl From<()> for Opt {
	fn from(_: ()) -> Self { Self }
}

impl Tasks {
	#[yazi_codegen::command]
	pub fn toggle(&mut self, _: Opt) {
		self.visible = !self.visible;

		if self.visible {
			self.summaries = self.paginate();
			self.arrow(0);
		}

		render!();
	}
}