use ansi_term::{unstyled_len, ANSIStrings};
use zellij_tile::prelude::actions::Action;
use zellij_tile::prelude::*;
use crate::color_elements;
use crate::{
action_key, action_key_group, get_common_modifier, style_key_with_modifier, TO_NORMAL,
};
use crate::{ColoredElements, LinePart};
struct KeyShortcut {
mode: KeyMode,
action: KeyAction,
key: Option<Key>,
}
#[derive(PartialEq)]
enum KeyAction {
Lock,
Pane,
Tab,
Resize,
Search,
Quit,
Session,
Move,
Tmux,
}
enum KeyMode {
Unselected,
UnselectedAlternate,
Selected,
Disabled,
}
impl KeyShortcut {
pub fn new(mode: KeyMode, action: KeyAction, key: Option<Key>) -> Self {
KeyShortcut { mode, action, key }
}
pub fn full_text(&self) -> String {
match self.action {
KeyAction::Lock => String::from("LOCK"),
KeyAction::Pane => String::from("PANE"),
KeyAction::Tab => String::from("TAB"),
KeyAction::Resize => String::from("RESIZE"),
KeyAction::Search => String::from("SEARCH"),
KeyAction::Quit => String::from("QUIT"),
KeyAction::Session => String::from("SESSION"),
KeyAction::Move => String::from("MOVE"),
KeyAction::Tmux => String::from("TMUX"),
}
}
pub fn letter_shortcut(&self, with_prefix: bool) -> String {
let key = match self.key {
Some(k) => k,
None => return String::from("?"),
};