elio 1.5.1

Snappy, batteries-included terminal file manager with rich previews, inline images, bulk actions, and trash support.
Documentation
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();
    }
}