pub mod command;
pub mod goto;
pub mod input;
pub mod normal;
pub mod select;
pub mod space;
use crossterm::event::{KeyEvent, KeyModifiers};
pub fn accepts_text(key: &KeyEvent) -> bool {
key.modifiers.difference(KeyModifiers::SHIFT).is_empty()
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum Mode {
Normal,
Select,
Space,
Goto,
Command,
Input(InputKind),
Finder,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum InputKind {
Rename,
Mkdir,
Search,
GlobSelect,
CommandLine,
}
impl Mode {
pub fn label(self) -> &'static str {
match self {
Mode::Normal => "NOR",
Mode::Select => "SEL",
Mode::Space => "SPC",
Mode::Goto => "GTO",
Mode::Command => "CMD",
Mode::Input(_) => "INP",
Mode::Finder => "FND",
}
}
}
#[derive(Debug, Clone)]
pub enum Action {
None,
Quit,
CursorUp,
CursorDown,
CursorTop,
CursorBottom,
PageUp,
PageDown,
HalfPageUp,
HalfPageDown,
EnterDir,
ParentDir,
SwitchPane,
FocusLeftPane,
FocusRightPane,
EnterSelect,
EnterSpace,
EnterGoto,
EnterCommand,
EnterInput(InputKind),
ExitToNormal,
ToggleSelect,
SelectAll,
InvertSelection,
SelectExtendDown,
SelectExtendUp,
DeselectAll,
CopyToOther,
MoveToOther,
DeleteSelected,
Rename(String),
Mkdir(String),
EditFile,
GotoHome,
GotoRoot,
GotoOtherPane,
GotoPrevious,
GotoBookmark(usize),
ExecuteCommand(String),
ToggleHidden,
SetSort(crate::pane::SortBy),
SetFilter(Option<String>),
ShowHelp,
ShowFileInfo,
InputChar(char),
InputBackspace,
InputConfirm,
InputCancel,
EnterFinder,
TogglePreview,
ViewFile,
}