mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
27 lines
522 B
Rust
27 lines
522 B
Rust
use std::collections::BTreeSet;
|
|
|
|
use yazi_macro::render;
|
|
use yazi_shared::event::CmdCow;
|
|
|
|
use crate::tab::{Mode, Tab};
|
|
|
|
struct Opt {
|
|
unset: bool,
|
|
}
|
|
|
|
impl From<CmdCow> for Opt {
|
|
fn from(c: CmdCow) -> Self { Self { unset: c.bool("unset") } }
|
|
}
|
|
|
|
impl Tab {
|
|
#[yazi_codegen::command]
|
|
pub fn visual_mode(&mut self, opt: Opt) {
|
|
let idx = self.current.cursor;
|
|
if opt.unset {
|
|
self.mode = Mode::Unset(idx, BTreeSet::from([idx]));
|
|
} else {
|
|
self.mode = Mode::Select(idx, BTreeSet::from([idx]));
|
|
};
|
|
render!();
|
|
}
|
|
}
|