use std::borrow::Borrow;
use std::cmp::min;
use std::fs;
use std::path;
use std::path::PathBuf;
use crate::bulkrename::Bulkrename;
use crate::content_window::{ContentWindow, RESERVED_ROWS};
use crate::copy_move::CopyMove;
use crate::fileinfo::{FileKind, PathContent, SortBy};
use crate::filter::FilterKind;
use crate::fm_error::{ErrorVariant, FmError, FmResult};
use crate::last_edition::LastEdition;
use crate::mode::{MarkAction, Mode};
use crate::opener::execute_in_child;
use crate::preview::Preview;
use crate::status::Status;
use crate::tab::Tab;
use crate::term_manager::MIN_WIDTH_FOR_DUAL_PANE;
use copypasta::{ClipboardContext, ClipboardProvider};
use log::info;
/// Every kind of mutation of the application is defined here.
/// It mutates `Status` or its child `tab`.
pub struct EventExec {}
impl EventExec {
/// Reset the selected tab view to the default.
pub fn refresh_selected_view(status: &mut Status) -> FmResult<()> {
status.selected().refresh_view()
}
/// When a rezise event occurs, we may hide the second panel if the width
/// isn't sufficiant to display enough information.
/// We also need to know the new height of the terminal to start scrolling
/// up or down.
pub fn resize(status: &mut Status, width: usize, height: usize) -> FmResult<()> {
if width < MIN_WIDTH_FOR_DUAL_PANE {
status.select_tab(0)?;
status.set_dual_pane(false);
} else {
status.set_dual_pane(true);
}
status.selected().set_height(height);
Self::refresh_selected_view(status)?;
Ok(())
}
/// Remove every flag on files in this directory and others.
pub fn event_clear_flags(status: &mut Status) ->