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 28 29 30 31 32 33 34 35 36 37
use super::*; impl App { pub fn is_selected(&self, path: &std::path::Path) -> bool { self.navigation.selected_paths.contains(path) } pub fn selection_count(&self) -> usize { self.navigation.selected_paths.len() } pub(in crate::app) fn toggle_selection(&mut self) { let Some(entry) = self.selected_entry() else { return; }; let path = entry.path.clone(); if !self.navigation.selected_paths.remove(&path) { self.navigation.selected_paths.insert(path); } if self.navigation.view_mode == ViewMode::List { self.move_vertical(1); } } pub(in crate::app) fn select_all(&mut self) { self.navigation.selected_paths = self .navigation .entries .iter() .map(|e| e.path.clone()) .collect(); } pub(in crate::app) fn clear_selection(&mut self) { self.navigation.selected_paths.clear(); } }