diff --git a/assets/plugins/status-bar.wasm b/assets/plugins/status-bar.wasm index 85b50ec4..f9c32980 100644 Binary files a/assets/plugins/status-bar.wasm and b/assets/plugins/status-bar.wasm differ diff --git a/assets/plugins/strider.wasm b/assets/plugins/strider.wasm index 46920fba..d82b57ca 100644 Binary files a/assets/plugins/strider.wasm and b/assets/plugins/strider.wasm differ diff --git a/default-tiles/status-bar/src/main.rs b/default-tiles/status-bar/src/main.rs index ba1868ea..e5de067d 100644 --- a/default-tiles/status-bar/src/main.rs +++ b/default-tiles/status-bar/src/main.rs @@ -24,18 +24,13 @@ impl Display for LinePart { fn prefix(help: &Help) -> LinePart { let prefix_text = " Zellij "; - let part = match (&help.mode, help.mode_is_persistent) { - (InputMode::Command, false) => { + let part = match &help.mode { + InputMode::Command => { let prefix = prefix_text.bold().white().on_black(); let separator = ARROW_SEPARATOR.black().on_magenta(); format!("{}{}", prefix, separator) } - (_, true) => { - let prefix = prefix_text.bold().white().on_black(); - let separator = ARROW_SEPARATOR.black().on_yellow(); - format!("{}{}", prefix, separator) - } - (InputMode::Normal, _) => { + InputMode::Normal => { let prefix = prefix_text.bold().white().on_black(); let separator = ARROW_SEPARATOR.black().on_green(); format!("{}{}", prefix, separator) @@ -52,9 +47,8 @@ fn prefix(help: &Help) -> LinePart { fn key_path(help: &Help) -> LinePart { let superkey_text = " "; - let locked_text = "LOCKED "; - let (part, len) = match (&help.mode, help.mode_is_persistent) { - (InputMode::Command, false) => { + let (part, len) = match &help.mode { + InputMode::Command => { let key_path = superkey_text.bold().on_magenta(); let first_separator = ARROW_SEPARATOR.magenta().on_black(); let len = superkey_text.chars().count() @@ -62,23 +56,7 @@ fn key_path(help: &Help) -> LinePart { + ARROW_SEPARATOR.chars().count(); (format!("{}{}", key_path, first_separator), len) } - (InputMode::Command, true) => { - let locked = locked_text.bold().white().on_yellow(); - let locked_separator = ARROW_SEPARATOR.yellow().on_magenta(); - let key_path = superkey_text.bold().on_magenta(); - let superkey_separator = ARROW_SEPARATOR.magenta().on_black(); - let len = superkey_text.chars().count() - + ARROW_SEPARATOR.chars().count() - + locked_text.chars().count(); - ( - format!( - "{}{}{}{}", - locked, locked_separator, key_path, superkey_separator - ), - len, - ) - } - (InputMode::Resize, false) => { + InputMode::Resize => { let mode_shortcut_text = "r "; let superkey = superkey_text.bold().on_magenta(); let first_superkey_separator = ARROW_SEPARATOR.magenta().on_black(); @@ -102,37 +80,7 @@ fn key_path(help: &Help) -> LinePart { len, ) } - (InputMode::Resize, true) => { - let mode_shortcut_text = "r "; - let locked = locked_text.white().bold().on_yellow(); - let locked_separator = ARROW_SEPARATOR.yellow().on_magenta(); - let superkey = superkey_text.bold().on_magenta(); - let first_superkey_separator = ARROW_SEPARATOR.magenta().on_black(); - let second_superkey_separator = ARROW_SEPARATOR.black().on_magenta(); - let mode_shortcut = mode_shortcut_text.white().bold().on_magenta(); - let mode_shortcut_separator = ARROW_SEPARATOR.magenta().on_black(); - let len = locked_text.chars().count() - + ARROW_SEPARATOR.chars().count() - + superkey_text.chars().count() - + ARROW_SEPARATOR.chars().count() - + ARROW_SEPARATOR.chars().count() - + mode_shortcut_text.chars().count() - + ARROW_SEPARATOR.chars().count(); - ( - format!( - "{}{}{}{}{}{}{}", - locked, - locked_separator, - superkey, - first_superkey_separator, - second_superkey_separator, - mode_shortcut, - mode_shortcut_separator - ), - len, - ) - } - (InputMode::Pane, false) => { + InputMode::Pane => { let mode_shortcut_text = "p "; let superkey = superkey_text.bold().on_magenta(); let first_superkey_separator = ARROW_SEPARATOR.magenta().on_black(); @@ -156,37 +104,7 @@ fn key_path(help: &Help) -> LinePart { len, ) } - (InputMode::Pane, true) => { - let mode_shortcut_text = "p "; - let locked = locked_text.white().bold().on_yellow(); - let locked_separator = ARROW_SEPARATOR.yellow().on_magenta(); - let superkey = superkey_text.bold().on_magenta(); - let first_superkey_separator = ARROW_SEPARATOR.magenta().on_black(); - let second_superkey_separator = ARROW_SEPARATOR.black().on_magenta(); - let mode_shortcut = mode_shortcut_text.white().bold().on_magenta(); - let mode_shortcut_separator = ARROW_SEPARATOR.magenta().on_black(); - let len = locked_text.chars().count() - + ARROW_SEPARATOR.chars().count() - + superkey_text.chars().count() - + ARROW_SEPARATOR.chars().count() - + ARROW_SEPARATOR.chars().count() - + mode_shortcut_text.chars().count() - + ARROW_SEPARATOR.chars().count(); - ( - format!( - "{}{}{}{}{}{}{}", - locked, - locked_separator, - superkey, - first_superkey_separator, - second_superkey_separator, - mode_shortcut, - mode_shortcut_separator - ), - len, - ) - } - (InputMode::Tab, false) => { + InputMode::Tab => { let mode_shortcut_text = "t "; let superkey = superkey_text.bold().on_magenta(); let first_superkey_separator = ARROW_SEPARATOR.magenta().on_black(); @@ -210,37 +128,7 @@ fn key_path(help: &Help) -> LinePart { len, ) } - (InputMode::Tab, true) => { - let mode_shortcut_text = "t "; - let locked = locked_text.white().bold().on_yellow(); - let locked_separator = ARROW_SEPARATOR.yellow().on_magenta(); - let superkey = superkey_text.bold().on_magenta(); - let first_superkey_separator = ARROW_SEPARATOR.magenta().on_black(); - let second_superkey_separator = ARROW_SEPARATOR.black().on_magenta(); - let mode_shortcut = mode_shortcut_text.white().bold().on_magenta(); - let mode_shortcut_separator = ARROW_SEPARATOR.magenta().on_black(); - let len = locked_text.chars().count() - + ARROW_SEPARATOR.chars().count() - + superkey_text.chars().count() - + ARROW_SEPARATOR.chars().count() - + ARROW_SEPARATOR.chars().count() - + mode_shortcut_text.chars().count() - + ARROW_SEPARATOR.chars().count(); - ( - format!( - "{}{}{}{}{}{}{}", - locked, - locked_separator, - superkey, - first_superkey_separator, - second_superkey_separator, - mode_shortcut, - mode_shortcut_separator - ), - len, - ) - } - (InputMode::Scroll, false) => { + InputMode::Scroll => { let mode_shortcut_text = "s "; let superkey = superkey_text.bold().on_magenta(); let first_superkey_separator = ARROW_SEPARATOR.magenta().on_black(); @@ -264,37 +152,7 @@ fn key_path(help: &Help) -> LinePart { len, ) } - (InputMode::Scroll, true) => { - let mode_shortcut_text = "s "; - let locked = locked_text.white().bold().on_yellow(); - let locked_separator = ARROW_SEPARATOR.yellow().on_magenta(); - let superkey = superkey_text.bold().on_magenta(); - let first_superkey_separator = ARROW_SEPARATOR.magenta().on_black(); - let second_superkey_separator = ARROW_SEPARATOR.black().on_magenta(); - let mode_shortcut = mode_shortcut_text.white().bold().on_magenta(); - let mode_shortcut_separator = ARROW_SEPARATOR.magenta().on_black(); - let len = locked_text.chars().count() - + ARROW_SEPARATOR.chars().count() - + superkey_text.chars().count() - + ARROW_SEPARATOR.chars().count() - + ARROW_SEPARATOR.chars().count() - + mode_shortcut_text.chars().count() - + ARROW_SEPARATOR.chars().count(); - ( - format!( - "{}{}{}{}{}{}{}", - locked, - locked_separator, - superkey, - first_superkey_separator, - second_superkey_separator, - mode_shortcut, - mode_shortcut_separator - ), - len, - ) - } - (InputMode::Normal, _) | _ => { + InputMode::Normal | _ => { let key_path = superkey_text.on_green(); let separator = ARROW_SEPARATOR.green().on_black(); ( diff --git a/src/common/input/actions.rs b/src/common/input/actions.rs index 0e3243a3..ae212e32 100644 --- a/src/common/input/actions.rs +++ b/src/common/input/actions.rs @@ -1,5 +1,6 @@ -/// This module is for defining the set of actions that can be taken in response to a keybind -/// and also passing actions back to the handler for dispatch. +/// This module is for defining the set of actions that can be taken in +/// response to a keybind and also passing actions back to the handler +/// for dispatch. use super::handler; #[derive(Clone)] @@ -12,36 +13,35 @@ pub enum Direction { #[derive(Clone)] pub enum Action { - /// Quit Zellij + /// Quit Zellij. Quit, - /// Write to terminal + /// Write to the terminal. Write(Vec), - /// Switch to the specified input mode + /// Switch to the specified input mode. SwitchToMode(handler::InputMode), - TogglePersistentMode, - /// Resize focus pane in specified direction + /// Resize focus pane in specified direction. Resize(Direction), - /// Switch focus to next pane in specified direction + /// Switch focus to next pane in specified direction. SwitchFocus(Direction), - /// Move the focus pane in specified direction + /// Move the focus pane in specified direction. MoveFocus(Direction), - /// Scroll up in focus pane + /// Scroll up in focus pane. ScrollUp, - /// Scroll down in focus pane + /// Scroll down in focus pane. ScrollDown, - /// Toggle focus pane between fullscreen and normal layout + /// Toggle between fullscreen focus pane and normal layout. ToggleFocusFullscreen, - /// Open a new pane in specified direction (relative to focus) - /// If no direction is specified, will try to use the biggest available space + /// Open a new pane in the specified direction (relative to focus). + /// If no direction is specified, will try to use the biggest available space. NewPane(Option), - /// Close focus pane + /// Close the focus pane. CloseFocus, - // Create a new tab + /// Create a new tab. NewTab, - // Go to next tab + /// Go to the next tab. GoToNextTab, - // Go to previous tab + /// Go to the previous tab. GoToPreviousTab, - // Close the current tab + /// Close the current tab. CloseTab, } diff --git a/src/common/input/handler.rs b/src/common/input/handler.rs index 136dacba..74235ff7 100644 --- a/src/common/input/handler.rs +++ b/src/common/input/handler.rs @@ -13,11 +13,12 @@ use serde::{Deserialize, Serialize}; use strum_macros::EnumIter; use termion::input::TermReadEventsAndRaw; -use super::keybinds::key_to_action; +use super::keybinds::key_to_actions; +/// Handles the dispatching of [`Action`]s according to the current +/// [`InputMode`], as well as changes to that mode. struct InputHandler { mode: InputMode, - mode_is_persistent: bool, os_input: Box, command_is_executing: CommandIsExecuting, send_screen_instructions: SenderWithContext, @@ -37,7 +38,6 @@ impl InputHandler { ) -> Self { InputHandler { mode: InputMode::Normal, - mode_is_persistent: false, os_input, command_is_executing, send_screen_instructions, @@ -47,7 +47,9 @@ impl InputHandler { } } - /// Main event loop + /// Main event loop. Interprets the terminal [`Event`](termion::event::Event)s + /// as [`Action`]s according to the current [`InputMode`], and dispatches those + /// actions. fn get_input(&mut self) { let mut err_ctx = OPENCALLS.with(|ctx| *ctx.borrow()); err_ctx.add_call(ContextType::StdinHandler); @@ -56,7 +58,6 @@ impl InputHandler { self.send_screen_instructions.update(err_ctx); if let Ok(keybinds) = get_default_keybinds() { 'input_loop: loop { - let entry_mode = self.mode; //@@@ I think this should actually just iterate over stdin directly let stdin_buffer = self.os_input.read_from_stdin(); drop( @@ -67,20 +68,19 @@ impl InputHandler { match key_result { Ok((event, raw_bytes)) => match event { termion::event::Event::Key(key) => { - let should_break = self.dispatch_action(key_to_action( - &key, raw_bytes, &self.mode, &keybinds, - )); - //@@@ This is a hack until we dispatch more than one action per key stroke - if entry_mode == self.mode && !self.mode_is_persistent { - self.mode = InputMode::Normal; - update_state(&self.send_app_instructions, |_| AppState { - input_state: InputState { - mode: self.mode, - persistent: self.mode_is_persistent, - }, - }); - } - if should_break { + // FIXME this explicit break is needed because the current test + // framework relies on it to not create dead threads that loop + // and eat up CPUs. Do not remove until the test framework has + // been revised. Sorry about this (@categorille) + if { + let mut should_break = false; + for action in + key_to_actions(&key, raw_bytes, &self.mode, &keybinds) + { + should_break |= self.dispatch_action(action); + } + should_break + } { break 'input_loop; } } @@ -100,7 +100,7 @@ impl InputHandler { } fn dispatch_action(&mut self, action: Action) -> bool { - let mut interrupt_loop = false; + let mut should_break = false; match action { Action::Write(val) => { @@ -113,32 +113,17 @@ impl InputHandler { } Action::Quit => { self.exit(); - interrupt_loop = true; + should_break = true; } Action::SwitchToMode(mode) => { self.mode = mode; - if mode == InputMode::Normal { - self.mode_is_persistent = false; - } update_state(&self.send_app_instructions, |_| AppState { - input_state: InputState { - mode: self.mode, - persistent: self.mode_is_persistent, - }, + input_mode: self.mode, }); self.send_screen_instructions .send(ScreenInstruction::Render) .unwrap(); } - Action::TogglePersistentMode => { - self.mode_is_persistent = !self.mode_is_persistent; - update_state(&self.send_app_instructions, |_| AppState { - input_state: InputState { - mode: self.mode, - persistent: self.mode_is_persistent, - }, - }); - } Action::Resize(direction) => { let screen_instr = match direction { super::actions::Direction::Left => ScreenInstruction::ResizeLeft, @@ -231,7 +216,7 @@ impl InputHandler { } } - interrupt_loop + should_break } /// Routine to be called when the input handler exits (at the moment this is the @@ -243,28 +228,14 @@ impl InputHandler { } } -#[derive(Debug, PartialEq, Eq, Hash, Copy, Clone, Serialize, Deserialize)] -pub struct InputState { - mode: InputMode, - persistent: bool, -} - -impl Default for InputState { - fn default() -> InputState { - InputState { - mode: InputMode::Normal, - persistent: false, - } - } -} - -/// Dictates whether we're in command mode, persistent command mode, normal mode or exiting: -/// - Normal mode either writes characters to the terminal, or switches to command mode +/// Dictates the input mode, which is the way that keystrokes will be interpreted: +/// - Normal mode either writes characters to the terminal, or switches to Command mode /// using a particular key control -/// - Command mode intercepts characters to control zellij itself, before switching immediately -/// back to normal mode -/// - Persistent command mode is the same as command mode, but doesn't return automatically to -/// normal mode +/// - Command mode is a menu that allows choosing another mode, like Resize or Pane +/// - Resize mode is for resizing the different panes already present +/// - Pane mode is for creating and closing panes in different directions +/// - Tab mode is for creating tabs and moving between them +/// - Scroll mode is for scrolling up and down within a pane #[derive(Debug, PartialEq, Eq, Hash, Copy, Clone, EnumIter, Serialize, Deserialize)] pub enum InputMode { Normal, @@ -276,10 +247,12 @@ pub enum InputMode { Exiting, } +/// Represents the help message that is printed in the status bar, indicating +/// the current [`InputMode`], whether that mode is persistent, and what the +/// keybinds for that mode are. #[derive(Default, Debug, Clone, Serialize, Deserialize)] pub struct Help { pub mode: InputMode, - pub mode_is_persistent: bool, pub keybinds: Vec<(String, String)>, // => } @@ -289,46 +262,45 @@ impl Default for InputMode { } } -pub fn get_help(input_state: &InputState) -> Help { +/// Creates a [`Help`] struct holding the current [`InputMode`] and its keybinds. +// TODO this should probably be automatically generated in some way +pub fn get_help(mode: InputMode) -> Help { let mut keybinds: Vec<(String, String)> = vec![]; - match input_state.mode { + match mode { InputMode::Normal | InputMode::Command | InputMode::Exiting => { - keybinds.push((format!("p"), format!("Pane mode"))); - keybinds.push((format!("t"), format!("Tab mode"))); - keybinds.push((format!("r"), format!("Resize mode"))); + keybinds.push((format!("p"), format!("PANE"))); + keybinds.push((format!("t"), format!("TAB"))); + keybinds.push((format!("r"), format!("RESIZE"))); + keybinds.push((format!("s"), format!("SCROLL"))); } InputMode::Resize => { - keybinds.push((format!("←↓↑→"), format!("resize pane"))); + keybinds.push((format!("←↓↑→"), format!("Resize"))); } InputMode::Pane => { - keybinds.push((format!("←↓↑→"), format!("move focus"))); - keybinds.push((format!("p"), format!("next pane"))); - keybinds.push((format!("n"), format!("new pane"))); - keybinds.push((format!("d"), format!("down split"))); - keybinds.push((format!("r"), format!("right split"))); - keybinds.push((format!("x"), format!("exit pane"))); - keybinds.push((format!("f"), format!("fullscreen pane"))); + keybinds.push((format!("←↓↑→"), format!("Move focus"))); + keybinds.push((format!("p"), format!("Next"))); + keybinds.push((format!("n"), format!("New"))); + keybinds.push((format!("d"), format!("Split down"))); + keybinds.push((format!("r"), format!("Split right"))); + keybinds.push((format!("x"), format!("Close"))); + keybinds.push((format!("f"), format!("Fullscreen"))); } InputMode::Tab => { - keybinds.push((format!("←↓↑→"), format!("move tab focus"))); - keybinds.push((format!("n"), format!("new tab"))); - keybinds.push((format!("x"), format!("exit tab"))); + keybinds.push((format!("←↓↑→"), format!("Move focus"))); + keybinds.push((format!("n"), format!("New"))); + keybinds.push((format!("x"), format!("Close"))); } InputMode::Scroll => { - keybinds.push((format!("↓↑"), format!("scroll up/down"))); + keybinds.push((format!("↓↑"), format!("Scroll"))); } } - keybinds.push((format!("ESC"), format!("Back"))); - keybinds.push((format!("q"), format!("Quit"))); - Help { - mode: input_state.mode, - mode_is_persistent: input_state.persistent, - keybinds, - } + keybinds.push((format!("ESC"), format!("BACK"))); + keybinds.push((format!("q"), format!("QUIT"))); + Help { mode, keybinds } } -/// Entry point to the module that instantiates a new InputHandler and calls its -/// reading loop +/// Entry point to the module. Instantiates a new InputHandler and calls its +/// input loop. pub fn input_loop( os_input: Box, command_is_executing: CommandIsExecuting, diff --git a/src/common/input/keybinds.rs b/src/common/input/keybinds.rs index d6ace68d..2e65ab35 100644 --- a/src/common/input/keybinds.rs +++ b/src/common/input/keybinds.rs @@ -1,4 +1,4 @@ -// This module is for mapping particular input keys to their corresponding actions. +//! Mapping of inputs to sequences of actions use super::actions::{Action, Direction}; use super::handler::InputMode; @@ -9,9 +9,9 @@ use strum::IntoEnumIterator; use termion::event::Key; type Keybinds = HashMap; -type ModeKeybinds = HashMap; +type ModeKeybinds = HashMap>; -/// Populate the default hashmap of keybinds +/// Populates the default hashmap of keybinds. /// @@@khs26 What about an input config file? pub fn get_default_keybinds() -> Result { let mut defaults = Keybinds::new(); @@ -23,106 +23,134 @@ pub fn get_default_keybinds() -> Result { Ok(defaults) } +/// Returns the default keybinds for a givent [`InputMode`]. fn get_defaults_for_mode(mode: &InputMode) -> Result { let mut defaults = ModeKeybinds::new(); match *mode { InputMode::Normal => { - defaults.insert(Key::Ctrl('g'), Action::SwitchToMode(InputMode::Command)); + defaults.insert( + Key::Ctrl('g'), + vec![Action::SwitchToMode(InputMode::Command)], + ); } InputMode::Command => { - defaults.insert(Key::Char('r'), Action::SwitchToMode(InputMode::Resize)); - defaults.insert(Key::Char('p'), Action::SwitchToMode(InputMode::Pane)); - defaults.insert(Key::Char('t'), Action::SwitchToMode(InputMode::Tab)); - defaults.insert(Key::Char('s'), Action::SwitchToMode(InputMode::Scroll)); - defaults.insert(Key::Ctrl('g'), Action::TogglePersistentMode); - defaults.insert(Key::Esc, Action::SwitchToMode(InputMode::Normal)); - defaults.insert(Key::Char('q'), Action::Quit); + defaults.insert( + Key::Char('r'), + vec![Action::SwitchToMode(InputMode::Resize)], + ); + defaults.insert(Key::Char('p'), vec![Action::SwitchToMode(InputMode::Pane)]); + defaults.insert(Key::Char('t'), vec![Action::SwitchToMode(InputMode::Tab)]); + defaults.insert( + Key::Char('s'), + vec![Action::SwitchToMode(InputMode::Scroll)], + ); + defaults.insert( + Key::Ctrl('g'), + vec![Action::SwitchToMode(InputMode::Normal)], + ); + defaults.insert(Key::Esc, vec![Action::SwitchToMode(InputMode::Normal)]); + defaults.insert(Key::Char('q'), vec![Action::Quit]); } InputMode::Resize => { - defaults.insert(Key::Char('h'), Action::Resize(Direction::Left)); - defaults.insert(Key::Char('j'), Action::Resize(Direction::Down)); - defaults.insert(Key::Char('k'), Action::Resize(Direction::Up)); - defaults.insert(Key::Char('l'), Action::Resize(Direction::Right)); + defaults.insert(Key::Char('h'), vec![Action::Resize(Direction::Left)]); + defaults.insert(Key::Char('j'), vec![Action::Resize(Direction::Down)]); + defaults.insert(Key::Char('k'), vec![Action::Resize(Direction::Up)]); + defaults.insert(Key::Char('l'), vec![Action::Resize(Direction::Right)]); - defaults.insert(Key::Left, Action::Resize(Direction::Left)); - defaults.insert(Key::Down, Action::Resize(Direction::Down)); - defaults.insert(Key::Up, Action::Resize(Direction::Up)); - defaults.insert(Key::Right, Action::Resize(Direction::Right)); + defaults.insert(Key::Left, vec![Action::Resize(Direction::Left)]); + defaults.insert(Key::Down, vec![Action::Resize(Direction::Down)]); + defaults.insert(Key::Up, vec![Action::Resize(Direction::Up)]); + defaults.insert(Key::Right, vec![Action::Resize(Direction::Right)]); - defaults.insert(Key::Ctrl('b'), Action::Resize(Direction::Left)); - defaults.insert(Key::Ctrl('n'), Action::Resize(Direction::Down)); - defaults.insert(Key::Ctrl('p'), Action::Resize(Direction::Up)); - defaults.insert(Key::Ctrl('f'), Action::Resize(Direction::Right)); + defaults.insert(Key::Ctrl('b'), vec![Action::Resize(Direction::Left)]); + defaults.insert(Key::Ctrl('n'), vec![Action::Resize(Direction::Down)]); + defaults.insert(Key::Ctrl('p'), vec![Action::Resize(Direction::Up)]); + defaults.insert(Key::Ctrl('f'), vec![Action::Resize(Direction::Right)]); - defaults.insert(Key::Char('q'), Action::Quit); - defaults.insert(Key::Ctrl('g'), Action::TogglePersistentMode); - defaults.insert(Key::Esc, Action::SwitchToMode(InputMode::Normal)); + defaults.insert(Key::Char('q'), vec![Action::Quit]); + defaults.insert( + Key::Ctrl('g'), + vec![Action::SwitchToMode(InputMode::Normal)], + ); + defaults.insert(Key::Esc, vec![Action::SwitchToMode(InputMode::Command)]); } InputMode::Pane => { - defaults.insert(Key::Char('h'), Action::MoveFocus(Direction::Left)); - defaults.insert(Key::Char('j'), Action::MoveFocus(Direction::Down)); - defaults.insert(Key::Char('k'), Action::MoveFocus(Direction::Up)); - defaults.insert(Key::Char('l'), Action::MoveFocus(Direction::Right)); + defaults.insert(Key::Char('h'), vec![Action::MoveFocus(Direction::Left)]); + defaults.insert(Key::Char('j'), vec![Action::MoveFocus(Direction::Down)]); + defaults.insert(Key::Char('k'), vec![Action::MoveFocus(Direction::Up)]); + defaults.insert(Key::Char('l'), vec![Action::MoveFocus(Direction::Right)]); - defaults.insert(Key::Left, Action::MoveFocus(Direction::Left)); - defaults.insert(Key::Down, Action::MoveFocus(Direction::Down)); - defaults.insert(Key::Up, Action::MoveFocus(Direction::Up)); - defaults.insert(Key::Right, Action::MoveFocus(Direction::Right)); + defaults.insert(Key::Left, vec![Action::MoveFocus(Direction::Left)]); + defaults.insert(Key::Down, vec![Action::MoveFocus(Direction::Down)]); + defaults.insert(Key::Up, vec![Action::MoveFocus(Direction::Up)]); + defaults.insert(Key::Right, vec![Action::MoveFocus(Direction::Right)]); - defaults.insert(Key::Ctrl('b'), Action::MoveFocus(Direction::Left)); - defaults.insert(Key::Ctrl('n'), Action::MoveFocus(Direction::Down)); - defaults.insert(Key::Ctrl('p'), Action::MoveFocus(Direction::Up)); - defaults.insert(Key::Ctrl('f'), Action::MoveFocus(Direction::Right)); + defaults.insert(Key::Ctrl('b'), vec![Action::MoveFocus(Direction::Left)]); + defaults.insert(Key::Ctrl('n'), vec![Action::MoveFocus(Direction::Down)]); + defaults.insert(Key::Ctrl('p'), vec![Action::MoveFocus(Direction::Up)]); + defaults.insert(Key::Ctrl('f'), vec![Action::MoveFocus(Direction::Right)]); - defaults.insert(Key::Char('p'), Action::SwitchFocus(Direction::Right)); - defaults.insert(Key::Char('n'), Action::NewPane(None)); - defaults.insert(Key::Char('d'), Action::NewPane(Some(Direction::Down))); - defaults.insert(Key::Char('r'), Action::NewPane(Some(Direction::Right))); - defaults.insert(Key::Char('x'), Action::CloseFocus); + defaults.insert(Key::Char('p'), vec![Action::SwitchFocus(Direction::Right)]); + defaults.insert(Key::Char('n'), vec![Action::NewPane(None)]); + defaults.insert(Key::Char('d'), vec![Action::NewPane(Some(Direction::Down))]); + defaults.insert( + Key::Char('r'), + vec![Action::NewPane(Some(Direction::Right))], + ); + defaults.insert(Key::Char('x'), vec![Action::CloseFocus]); - defaults.insert(Key::Char('f'), Action::ToggleFocusFullscreen); + defaults.insert(Key::Char('f'), vec![Action::ToggleFocusFullscreen]); - defaults.insert(Key::Char('q'), Action::Quit); - defaults.insert(Key::Ctrl('g'), Action::TogglePersistentMode); - defaults.insert(Key::Esc, Action::SwitchToMode(InputMode::Normal)); + defaults.insert(Key::Char('q'), vec![Action::Quit]); + defaults.insert( + Key::Ctrl('g'), + vec![Action::SwitchToMode(InputMode::Normal)], + ); + defaults.insert(Key::Esc, vec![Action::SwitchToMode(InputMode::Command)]); } InputMode::Tab => { - defaults.insert(Key::Char('h'), Action::GoToPreviousTab); - defaults.insert(Key::Char('j'), Action::GoToNextTab); - defaults.insert(Key::Char('k'), Action::GoToPreviousTab); - defaults.insert(Key::Char('l'), Action::GoToNextTab); + defaults.insert(Key::Char('h'), vec![Action::GoToPreviousTab]); + defaults.insert(Key::Char('j'), vec![Action::GoToNextTab]); + defaults.insert(Key::Char('k'), vec![Action::GoToPreviousTab]); + defaults.insert(Key::Char('l'), vec![Action::GoToNextTab]); - defaults.insert(Key::Left, Action::GoToPreviousTab); - defaults.insert(Key::Down, Action::GoToNextTab); - defaults.insert(Key::Up, Action::GoToPreviousTab); - defaults.insert(Key::Right, Action::GoToNextTab); + defaults.insert(Key::Left, vec![Action::GoToPreviousTab]); + defaults.insert(Key::Down, vec![Action::GoToNextTab]); + defaults.insert(Key::Up, vec![Action::GoToPreviousTab]); + defaults.insert(Key::Right, vec![Action::GoToNextTab]); - defaults.insert(Key::Ctrl('b'), Action::GoToPreviousTab); - defaults.insert(Key::Ctrl('n'), Action::GoToNextTab); - defaults.insert(Key::Ctrl('p'), Action::GoToPreviousTab); - defaults.insert(Key::Ctrl('f'), Action::GoToNextTab); + defaults.insert(Key::Ctrl('b'), vec![Action::GoToPreviousTab]); + defaults.insert(Key::Ctrl('n'), vec![Action::GoToNextTab]); + defaults.insert(Key::Ctrl('p'), vec![Action::GoToPreviousTab]); + defaults.insert(Key::Ctrl('f'), vec![Action::GoToNextTab]); - defaults.insert(Key::Char('n'), Action::NewTab); - defaults.insert(Key::Char('x'), Action::CloseTab); + defaults.insert(Key::Char('n'), vec![Action::NewTab]); + defaults.insert(Key::Char('x'), vec![Action::CloseTab]); - defaults.insert(Key::Char('q'), Action::Quit); - defaults.insert(Key::Ctrl('g'), Action::TogglePersistentMode); - defaults.insert(Key::Esc, Action::SwitchToMode(InputMode::Normal)); + defaults.insert(Key::Char('q'), vec![Action::Quit]); + defaults.insert( + Key::Ctrl('g'), + vec![Action::SwitchToMode(InputMode::Normal)], + ); + defaults.insert(Key::Esc, vec![Action::SwitchToMode(InputMode::Command)]); } InputMode::Scroll => { - defaults.insert(Key::Char('j'), Action::ScrollDown); - defaults.insert(Key::Char('k'), Action::ScrollUp); + defaults.insert(Key::Char('j'), vec![Action::ScrollDown]); + defaults.insert(Key::Char('k'), vec![Action::ScrollUp]); - defaults.insert(Key::Down, Action::ScrollDown); - defaults.insert(Key::Up, Action::ScrollUp); + defaults.insert(Key::Down, vec![Action::ScrollDown]); + defaults.insert(Key::Up, vec![Action::ScrollUp]); - defaults.insert(Key::Ctrl('n'), Action::ScrollDown); - defaults.insert(Key::Ctrl('p'), Action::ScrollUp); + defaults.insert(Key::Ctrl('n'), vec![Action::ScrollDown]); + defaults.insert(Key::Ctrl('p'), vec![Action::ScrollUp]); - defaults.insert(Key::Char('q'), Action::Quit); - defaults.insert(Key::Ctrl('g'), Action::TogglePersistentMode); - defaults.insert(Key::Esc, Action::SwitchToMode(InputMode::Normal)); + defaults.insert(Key::Char('q'), vec![Action::Quit]); + defaults.insert( + Key::Ctrl('g'), + vec![Action::SwitchToMode(InputMode::Normal)], + ); + defaults.insert(Key::Esc, vec![Action::SwitchToMode(InputMode::Command)]); } InputMode::Exiting => {} } @@ -130,14 +158,23 @@ fn get_defaults_for_mode(mode: &InputMode) -> Result { Ok(defaults) } -pub fn key_to_action(key: &Key, input: Vec, mode: &InputMode, keybinds: &Keybinds) -> Action { +/// Converts a [`Key`] terminal event to a sequence of [`Action`]s according to the current +/// [`InputMode`] and [`Keybinds`]. +pub fn key_to_actions( + key: &Key, + input: Vec, + mode: &InputMode, + keybinds: &Keybinds, +) -> Vec { if let Some(mode_keybinds) = keybinds.get(mode) { mode_keybinds .get(key) .cloned() - .unwrap_or(Action::Write(input)) + // FIXME in command mode, unbound keystrokes should probably do nothing instead of + // writing to the terminal. Will be easier to implement after a big refactor of the + // input system (@categorille) + .unwrap_or(vec![Action::Write(input)]) } else { - // Unrecognized mode - panic? - panic!("Unrecognized mode: {:?}", mode); + unreachable!("Unrecognized mode: {:?}", mode); } } diff --git a/src/common/mod.rs b/src/common/mod.rs index 72a521a4..00ee64fd 100644 --- a/src/common/mod.rs +++ b/src/common/mod.rs @@ -17,7 +17,7 @@ use std::{collections::HashMap, fs}; use crate::panes::PaneId; use directories_next::ProjectDirs; -use input::handler::InputState; +use input::handler::InputMode; use serde::{Deserialize, Serialize}; use termion::input::TermRead; use wasm_vm::PluginEnv; @@ -45,7 +45,7 @@ pub enum ApiCommand { // FIXME: It would be good to add some more things to this over time #[derive(Debug, Clone, Default)] pub struct AppState { - pub input_state: InputState, + pub input_mode: InputMode, } // FIXME: Make this a method on the big `Communication` struct, so that app_tx can be extracted diff --git a/src/common/wasm_vm.rs b/src/common/wasm_vm.rs index fcc739cb..70808b5d 100644 --- a/src/common/wasm_vm.rs +++ b/src/common/wasm_vm.rs @@ -97,7 +97,7 @@ fn host_get_help(plugin_env: &PluginEnv) { .try_send(AppInstruction::GetState(state_tx)) .is_ok() { - let help = get_help(&state_rx.recv().unwrap().input_state); + let help = get_help(state_rx.recv().unwrap().input_mode); wasi_write_string(&plugin_env.wasi_env, &serde_json::to_string(&help).unwrap()); } } diff --git a/src/tests/integration/basic.rs b/src/tests/integration/basic.rs index 226b08f3..bf932813 100644 --- a/src/tests/integration/basic.rs +++ b/src/tests/integration/basic.rs @@ -23,7 +23,7 @@ pub fn starts_with_one_terminal() { y: 0, }; let mut fake_input_output = get_fake_os_input(&fake_win_size); - fake_input_output.add_terminal_input(&[&COMMAND_TOGGLE, &COMMAND_TOGGLE, &QUIT]); + fake_input_output.add_terminal_input(&[&COMMAND_TOGGLE, &QUIT]); start(Box::new(fake_input_output.clone()), CliArgs::default()); let output_frames = fake_input_output .stdout_writer @@ -46,7 +46,6 @@ pub fn split_terminals_vertically() { }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ - &COMMAND_TOGGLE, &COMMAND_TOGGLE, &PANE_MODE, &SPLIT_RIGHT_IN_PANE_MODE, @@ -74,7 +73,6 @@ pub fn split_terminals_horizontally() { }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ - &COMMAND_TOGGLE, &COMMAND_TOGGLE, &PANE_MODE, &SPLIT_DOWN_IN_PANE_MODE, @@ -103,7 +101,6 @@ pub fn split_largest_terminal() { }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ - &COMMAND_TOGGLE, &COMMAND_TOGGLE, &PANE_MODE, &SPAWN_TERMINAL_IN_PANE_MODE, @@ -133,7 +130,6 @@ pub fn cannot_split_terminals_vertically_when_active_terminal_is_too_small() { }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ - &COMMAND_TOGGLE, &COMMAND_TOGGLE, &PANE_MODE, &SPLIT_RIGHT_IN_PANE_MODE, @@ -161,7 +157,6 @@ pub fn cannot_split_terminals_horizontally_when_active_terminal_is_too_small() { }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ - &COMMAND_TOGGLE, &COMMAND_TOGGLE, &PANE_MODE, &SPLIT_DOWN_IN_PANE_MODE, @@ -189,7 +184,6 @@ pub fn cannot_split_largest_terminal_when_there_is_no_room() { }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ - &COMMAND_TOGGLE, &COMMAND_TOGGLE, &PANE_MODE, &SPAWN_TERMINAL_IN_PANE_MODE, @@ -217,14 +211,11 @@ pub fn scrolling_up_inside_a_pane() { }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ - &COMMAND_TOGGLE, &COMMAND_TOGGLE, &PANE_MODE, &SPLIT_DOWN_IN_PANE_MODE, &SPLIT_RIGHT_IN_PANE_MODE, &ESC, - &COMMAND_TOGGLE, - &COMMAND_TOGGLE, &SCROLL_MODE, &SCROLL_UP_IN_SCROLL_MODE, &SCROLL_UP_IN_SCROLL_MODE, @@ -252,14 +243,11 @@ pub fn scrolling_down_inside_a_pane() { }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ - &COMMAND_TOGGLE, &COMMAND_TOGGLE, &PANE_MODE, &SPLIT_DOWN_IN_PANE_MODE, &SPLIT_RIGHT_IN_PANE_MODE, &ESC, - &COMMAND_TOGGLE, - &COMMAND_TOGGLE, &SCROLL_MODE, &SCROLL_UP_IN_SCROLL_MODE, &SCROLL_UP_IN_SCROLL_MODE, @@ -291,7 +279,6 @@ pub fn max_panes() { }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ - &COMMAND_TOGGLE, &COMMAND_TOGGLE, &PANE_MODE, &SPAWN_TERMINAL_IN_PANE_MODE, @@ -324,7 +311,6 @@ pub fn toggle_focused_pane_fullscreen() { }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ - &COMMAND_TOGGLE, &COMMAND_TOGGLE, &PANE_MODE, &SPAWN_TERMINAL_IN_PANE_MODE, diff --git a/src/tests/integration/close_pane.rs b/src/tests/integration/close_pane.rs index be60fd7c..82bcb9a4 100644 --- a/src/tests/integration/close_pane.rs +++ b/src/tests/integration/close_pane.rs @@ -33,7 +33,6 @@ pub fn close_pane_with_another_pane_above_it() { }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ - &COMMAND_TOGGLE, &COMMAND_TOGGLE, &PANE_MODE, &SPLIT_DOWN_IN_PANE_MODE, @@ -71,7 +70,6 @@ pub fn close_pane_with_another_pane_below_it() { }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ - &COMMAND_TOGGLE, &COMMAND_TOGGLE, &PANE_MODE, &SPLIT_DOWN_IN_PANE_MODE, @@ -108,7 +106,6 @@ pub fn close_pane_with_another_pane_to_the_left() { }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ - &COMMAND_TOGGLE, &COMMAND_TOGGLE, &PANE_MODE, &SPLIT_RIGHT_IN_PANE_MODE, @@ -144,7 +141,6 @@ pub fn close_pane_with_another_pane_to_the_right() { }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ - &COMMAND_TOGGLE, &COMMAND_TOGGLE, &PANE_MODE, &SPLIT_RIGHT_IN_PANE_MODE, @@ -183,7 +179,6 @@ pub fn close_pane_with_multiple_panes_above_it() { }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ - &COMMAND_TOGGLE, &COMMAND_TOGGLE, &PANE_MODE, &SPLIT_DOWN_IN_PANE_MODE, @@ -225,7 +220,6 @@ pub fn close_pane_with_multiple_panes_below_it() { }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ - &COMMAND_TOGGLE, &COMMAND_TOGGLE, &PANE_MODE, &SPLIT_DOWN_IN_PANE_MODE, @@ -265,7 +259,6 @@ pub fn close_pane_with_multiple_panes_to_the_left() { }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ - &COMMAND_TOGGLE, &COMMAND_TOGGLE, &PANE_MODE, &SPLIT_RIGHT_IN_PANE_MODE, @@ -307,7 +300,6 @@ pub fn close_pane_with_multiple_panes_to_the_right() { }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ - &COMMAND_TOGGLE, &COMMAND_TOGGLE, &PANE_MODE, &SPLIT_RIGHT_IN_PANE_MODE, @@ -347,7 +339,6 @@ pub fn close_pane_with_multiple_panes_above_it_away_from_screen_edges() { }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ - &COMMAND_TOGGLE, &COMMAND_TOGGLE, &PANE_MODE, &SPLIT_DOWN_IN_PANE_MODE, @@ -357,23 +348,15 @@ pub fn close_pane_with_multiple_panes_above_it_away_from_screen_edges() { &SPLIT_RIGHT_IN_PANE_MODE, &SPLIT_RIGHT_IN_PANE_MODE, &ESC, - &COMMAND_TOGGLE, - &COMMAND_TOGGLE, &RESIZE_MODE, &RESIZE_UP_IN_RESIZE_MODE, &ESC, - &COMMAND_TOGGLE, - &COMMAND_TOGGLE, &PANE_MODE, &MOVE_FOCUS_IN_PANE_MODE, &ESC, - &COMMAND_TOGGLE, - &COMMAND_TOGGLE, &RESIZE_MODE, &RESIZE_UP_IN_RESIZE_MODE, &ESC, - &COMMAND_TOGGLE, - &COMMAND_TOGGLE, &PANE_MODE, &MOVE_FOCUS_IN_PANE_MODE, &MOVE_FOCUS_IN_PANE_MODE, @@ -417,7 +400,6 @@ pub fn close_pane_with_multiple_panes_below_it_away_from_screen_edges() { }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ - &COMMAND_TOGGLE, &COMMAND_TOGGLE, &PANE_MODE, &SPLIT_DOWN_IN_PANE_MODE, @@ -427,23 +409,15 @@ pub fn close_pane_with_multiple_panes_below_it_away_from_screen_edges() { &SPLIT_RIGHT_IN_PANE_MODE, &SPLIT_RIGHT_IN_PANE_MODE, &ESC, - &COMMAND_TOGGLE, - &COMMAND_TOGGLE, &RESIZE_MODE, &RESIZE_DOWN_IN_RESIZE_MODE, &ESC, - &COMMAND_TOGGLE, - &COMMAND_TOGGLE, &PANE_MODE, &MOVE_FOCUS_IN_PANE_MODE, &ESC, - &COMMAND_TOGGLE, - &COMMAND_TOGGLE, &RESIZE_MODE, &RESIZE_DOWN_IN_RESIZE_MODE, &ESC, - &COMMAND_TOGGLE, - &COMMAND_TOGGLE, &PANE_MODE, &MOVE_FOCUS_IN_PANE_MODE, &MOVE_FOCUS_IN_PANE_MODE, @@ -489,7 +463,6 @@ pub fn close_pane_with_multiple_panes_to_the_left_away_from_screen_edges() { }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ - &COMMAND_TOGGLE, &COMMAND_TOGGLE, &PANE_MODE, &SPLIT_RIGHT_IN_PANE_MODE, @@ -499,23 +472,15 @@ pub fn close_pane_with_multiple_panes_to_the_left_away_from_screen_edges() { &SPLIT_DOWN_IN_PANE_MODE, &SPLIT_DOWN_IN_PANE_MODE, &ESC, - &COMMAND_TOGGLE, - &COMMAND_TOGGLE, &RESIZE_MODE, &RESIZE_LEFT_IN_RESIZE_MODE, &ESC, - &COMMAND_TOGGLE, - &COMMAND_TOGGLE, &PANE_MODE, &MOVE_FOCUS_IN_PANE_MODE, &ESC, - &COMMAND_TOGGLE, - &COMMAND_TOGGLE, &RESIZE_MODE, &RESIZE_LEFT_IN_RESIZE_MODE, &ESC, - &COMMAND_TOGGLE, - &COMMAND_TOGGLE, &PANE_MODE, &MOVE_FOCUS_IN_PANE_MODE, &MOVE_FOCUS_IN_PANE_MODE, @@ -561,7 +526,6 @@ pub fn close_pane_with_multiple_panes_to_the_right_away_from_screen_edges() { }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ - &COMMAND_TOGGLE, &COMMAND_TOGGLE, &PANE_MODE, &SPLIT_RIGHT_IN_PANE_MODE, @@ -571,23 +535,15 @@ pub fn close_pane_with_multiple_panes_to_the_right_away_from_screen_edges() { &SPLIT_DOWN_IN_PANE_MODE, &SPLIT_DOWN_IN_PANE_MODE, &ESC, - &COMMAND_TOGGLE, - &COMMAND_TOGGLE, &RESIZE_MODE, &RESIZE_LEFT_IN_RESIZE_MODE, &ESC, - &COMMAND_TOGGLE, - &COMMAND_TOGGLE, &PANE_MODE, &MOVE_FOCUS_IN_PANE_MODE, &ESC, - &COMMAND_TOGGLE, - &COMMAND_TOGGLE, &RESIZE_MODE, &RESIZE_LEFT_IN_RESIZE_MODE, &ESC, - &COMMAND_TOGGLE, - &COMMAND_TOGGLE, &PANE_MODE, &MOVE_FOCUS_IN_PANE_MODE, &MOVE_FOCUS_IN_PANE_MODE, @@ -623,7 +579,6 @@ pub fn closing_last_pane_exits_app() { }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ - &COMMAND_TOGGLE, &COMMAND_TOGGLE, &PANE_MODE, &SPLIT_RIGHT_IN_PANE_MODE, diff --git a/src/tests/integration/compatibility.rs b/src/tests/integration/compatibility.rs index d64626e7..37149bc9 100644 --- a/src/tests/integration/compatibility.rs +++ b/src/tests/integration/compatibility.rs @@ -39,7 +39,7 @@ pub fn run_bandwhich_from_fish_shell() { }; let fixture_name = "fish_and_bandwhich"; let mut fake_input_output = get_fake_os_input(&fake_win_size, fixture_name); - fake_input_output.add_terminal_input(&[&COMMAND_TOGGLE, &COMMAND_TOGGLE, &QUIT]); + fake_input_output.add_terminal_input(&[&COMMAND_TOGGLE, &QUIT]); start(Box::new(fake_input_output.clone()), CliArgs::default()); let output_frames = fake_input_output .stdout_writer @@ -62,7 +62,7 @@ pub fn fish_tab_completion_options() { }; let fixture_name = "fish_tab_completion_options"; let mut fake_input_output = get_fake_os_input(&fake_win_size, fixture_name); - fake_input_output.add_terminal_input(&[&COMMAND_TOGGLE, &COMMAND_TOGGLE, &QUIT]); + fake_input_output.add_terminal_input(&[&COMMAND_TOGGLE, &QUIT]); start(Box::new(fake_input_output.clone()), CliArgs::default()); let output_frames = fake_input_output .stdout_writer @@ -90,7 +90,7 @@ pub fn fish_select_tab_completion_options() { }; let fixture_name = "fish_select_tab_completion_options"; let mut fake_input_output = get_fake_os_input(&fake_win_size, fixture_name); - fake_input_output.add_terminal_input(&[&COMMAND_TOGGLE, &COMMAND_TOGGLE, &QUIT]); + fake_input_output.add_terminal_input(&[&COMMAND_TOGGLE, &QUIT]); start(Box::new(fake_input_output.clone()), CliArgs::default()); let output_frames = fake_input_output .stdout_writer @@ -122,7 +122,7 @@ pub fn vim_scroll_region_down() { }; let fixture_name = "vim_scroll_region_down"; let mut fake_input_output = get_fake_os_input(&fake_win_size, fixture_name); - fake_input_output.add_terminal_input(&[&COMMAND_TOGGLE, &COMMAND_TOGGLE, &QUIT]); // quit (ctrl-q) + fake_input_output.add_terminal_input(&[&COMMAND_TOGGLE, &QUIT]); // quit (ctrl-q) start(Box::new(fake_input_output.clone()), CliArgs::default()); let output_frames = fake_input_output .stdout_writer @@ -151,7 +151,7 @@ pub fn vim_ctrl_d() { }; let fixture_name = "vim_ctrl_d"; let mut fake_input_output = get_fake_os_input(&fake_win_size, fixture_name); - fake_input_output.add_terminal_input(&[&COMMAND_TOGGLE, &COMMAND_TOGGLE, &QUIT]); + fake_input_output.add_terminal_input(&[&COMMAND_TOGGLE, &QUIT]); start(Box::new(fake_input_output.clone()), CliArgs::default()); let output_frames = fake_input_output .stdout_writer @@ -179,7 +179,7 @@ pub fn vim_ctrl_u() { }; let fixture_name = "vim_ctrl_u"; let mut fake_input_output = get_fake_os_input(&fake_win_size, fixture_name); - fake_input_output.add_terminal_input(&[&COMMAND_TOGGLE, &COMMAND_TOGGLE, &QUIT]); + fake_input_output.add_terminal_input(&[&COMMAND_TOGGLE, &QUIT]); start(Box::new(fake_input_output.clone()), CliArgs::default()); let output_frames = fake_input_output .stdout_writer @@ -202,7 +202,7 @@ pub fn htop() { }; let fixture_name = "htop"; let mut fake_input_output = get_fake_os_input(&fake_win_size, fixture_name); - fake_input_output.add_terminal_input(&[&COMMAND_TOGGLE, &COMMAND_TOGGLE, &QUIT]); + fake_input_output.add_terminal_input(&[&COMMAND_TOGGLE, &QUIT]); start(Box::new(fake_input_output.clone()), CliArgs::default()); let output_frames = fake_input_output .stdout_writer @@ -225,7 +225,7 @@ pub fn htop_scrolling() { }; let fixture_name = "htop_scrolling"; let mut fake_input_output = get_fake_os_input(&fake_win_size, fixture_name); - fake_input_output.add_terminal_input(&[&COMMAND_TOGGLE, &COMMAND_TOGGLE, &QUIT]); + fake_input_output.add_terminal_input(&[&COMMAND_TOGGLE, &QUIT]); start(Box::new(fake_input_output.clone()), CliArgs::default()); let output_frames = fake_input_output .stdout_writer @@ -248,7 +248,7 @@ pub fn htop_right_scrolling() { }; let fixture_name = "htop_right_scrolling"; let mut fake_input_output = get_fake_os_input(&fake_win_size, fixture_name); - fake_input_output.add_terminal_input(&[&COMMAND_TOGGLE, &COMMAND_TOGGLE, &QUIT]); + fake_input_output.add_terminal_input(&[&COMMAND_TOGGLE, &QUIT]); start(Box::new(fake_input_output.clone()), CliArgs::default()); let output_frames = fake_input_output .stdout_writer @@ -279,7 +279,7 @@ pub fn vim_overwrite() { }; let fixture_name = "vim_overwrite"; let mut fake_input_output = get_fake_os_input(&fake_win_size, fixture_name); - fake_input_output.add_terminal_input(&[&COMMAND_TOGGLE, &COMMAND_TOGGLE, &QUIT]); + fake_input_output.add_terminal_input(&[&COMMAND_TOGGLE, &QUIT]); start(Box::new(fake_input_output.clone()), CliArgs::default()); let output_frames = fake_input_output .stdout_writer @@ -305,7 +305,7 @@ pub fn clear_scroll_region() { }; let fixture_name = "clear_scroll_region"; let mut fake_input_output = get_fake_os_input(&fake_win_size, fixture_name); - fake_input_output.add_terminal_input(&[&COMMAND_TOGGLE, &COMMAND_TOGGLE, &QUIT]); + fake_input_output.add_terminal_input(&[&COMMAND_TOGGLE, &QUIT]); start(Box::new(fake_input_output.clone()), CliArgs::default()); let output_frames = fake_input_output .stdout_writer @@ -328,7 +328,7 @@ pub fn display_tab_characters_properly() { }; let fixture_name = "tab_characters"; let mut fake_input_output = get_fake_os_input(&fake_win_size, fixture_name); - fake_input_output.add_terminal_input(&[&COMMAND_TOGGLE, &COMMAND_TOGGLE, &QUIT]); + fake_input_output.add_terminal_input(&[&COMMAND_TOGGLE, &QUIT]); start(Box::new(fake_input_output.clone()), CliArgs::default()); let output_frames = fake_input_output .stdout_writer @@ -351,7 +351,7 @@ pub fn neovim_insert_mode() { }; let fixture_name = "nvim_insert"; let mut fake_input_output = get_fake_os_input(&fake_win_size, fixture_name); - fake_input_output.add_terminal_input(&[&COMMAND_TOGGLE, &COMMAND_TOGGLE, &QUIT]); + fake_input_output.add_terminal_input(&[&COMMAND_TOGGLE, &QUIT]); start(Box::new(fake_input_output.clone()), CliArgs::default()); let output_frames = fake_input_output .stdout_writer @@ -376,7 +376,7 @@ pub fn bash_cursor_linewrap() { }; let fixture_name = "bash_cursor_linewrap"; let mut fake_input_output = get_fake_os_input(&fake_win_size, fixture_name); - fake_input_output.add_terminal_input(&[&COMMAND_TOGGLE, &COMMAND_TOGGLE, &QUIT]); + fake_input_output.add_terminal_input(&[&COMMAND_TOGGLE, &QUIT]); start(Box::new(fake_input_output.clone()), CliArgs::default()); let output_frames = fake_input_output .stdout_writer @@ -401,7 +401,7 @@ pub fn fish_paste_multiline() { }; let fixture_name = "fish_paste_multiline"; let mut fake_input_output = get_fake_os_input(&fake_win_size, fixture_name); - fake_input_output.add_terminal_input(&[&COMMAND_TOGGLE, &COMMAND_TOGGLE, &QUIT]); + fake_input_output.add_terminal_input(&[&COMMAND_TOGGLE, &QUIT]); start(Box::new(fake_input_output.clone()), CliArgs::default()); let output_frames = fake_input_output .stdout_writer @@ -424,7 +424,7 @@ pub fn git_log() { }; let fixture_name = "git_log"; let mut fake_input_output = get_fake_os_input(&fake_win_size, fixture_name); - fake_input_output.add_terminal_input(&[&COMMAND_TOGGLE, &COMMAND_TOGGLE, &QUIT]); + fake_input_output.add_terminal_input(&[&COMMAND_TOGGLE, &QUIT]); start(Box::new(fake_input_output.clone()), CliArgs::default()); let output_frames = fake_input_output .stdout_writer @@ -449,7 +449,7 @@ pub fn git_diff_scrollup() { }; let fixture_name = "git_diff_scrollup"; let mut fake_input_output = get_fake_os_input(&fake_win_size, fixture_name); - fake_input_output.add_terminal_input(&[&COMMAND_TOGGLE, &COMMAND_TOGGLE, &QUIT]); + fake_input_output.add_terminal_input(&[&COMMAND_TOGGLE, &QUIT]); start(Box::new(fake_input_output.clone()), CliArgs::default()); let output_frames = fake_input_output .stdout_writer @@ -472,7 +472,7 @@ pub fn emacs_longbuf() { }; let fixture_name = "emacs_longbuf_tutorial"; let mut fake_input_output = get_fake_os_input(&fake_win_size, fixture_name); - fake_input_output.add_terminal_input(&[&COMMAND_TOGGLE, &COMMAND_TOGGLE, &QUIT]); + fake_input_output.add_terminal_input(&[&COMMAND_TOGGLE, &QUIT]); start(Box::new(fake_input_output.clone()), CliArgs::default()); let output_frames = fake_input_output .stdout_writer diff --git a/src/tests/integration/layouts.rs b/src/tests/integration/layouts.rs index cc7e66c2..9728e4ab 100644 --- a/src/tests/integration/layouts.rs +++ b/src/tests/integration/layouts.rs @@ -20,7 +20,7 @@ pub fn accepts_basic_layout() { y: 0, }; let mut fake_input_output = get_fake_os_input(&fake_win_size); - fake_input_output.add_terminal_input(&[&COMMAND_TOGGLE, &COMMAND_TOGGLE, &QUIT]); + fake_input_output.add_terminal_input(&[&COMMAND_TOGGLE, &QUIT]); let mut opts = CliArgs::default(); opts.layout = Some(PathBuf::from( "src/tests/fixtures/layouts/three-panes-with-nesting.yaml", diff --git a/src/tests/integration/move_focus_down.rs b/src/tests/integration/move_focus_down.rs index 639078d8..e241714a 100644 --- a/src/tests/integration/move_focus_down.rs +++ b/src/tests/integration/move_focus_down.rs @@ -24,7 +24,6 @@ pub fn move_focus_down() { }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ - &COMMAND_TOGGLE, &COMMAND_TOGGLE, &PANE_MODE, &SPLIT_DOWN_IN_PANE_MODE, @@ -55,7 +54,6 @@ pub fn move_focus_down_to_the_largest_overlap() { }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ - &COMMAND_TOGGLE, &COMMAND_TOGGLE, &PANE_MODE, &SPLIT_DOWN_IN_PANE_MODE, diff --git a/src/tests/integration/move_focus_left.rs b/src/tests/integration/move_focus_left.rs index a8e073b9..153188d3 100644 --- a/src/tests/integration/move_focus_left.rs +++ b/src/tests/integration/move_focus_left.rs @@ -24,7 +24,6 @@ pub fn move_focus_left() { }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ - &COMMAND_TOGGLE, &COMMAND_TOGGLE, &PANE_MODE, &SPLIT_RIGHT_IN_PANE_MODE, @@ -54,7 +53,6 @@ pub fn move_focus_left_to_the_largest_overlap() { }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ - &COMMAND_TOGGLE, &COMMAND_TOGGLE, &PANE_MODE, &SPLIT_RIGHT_IN_PANE_MODE, diff --git a/src/tests/integration/move_focus_right.rs b/src/tests/integration/move_focus_right.rs index 72c24a9b..d9b243fb 100644 --- a/src/tests/integration/move_focus_right.rs +++ b/src/tests/integration/move_focus_right.rs @@ -24,7 +24,6 @@ pub fn move_focus_right() { }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ - &COMMAND_TOGGLE, &COMMAND_TOGGLE, &PANE_MODE, &SPLIT_RIGHT_IN_PANE_MODE, @@ -55,7 +54,6 @@ pub fn move_focus_right_to_the_largest_overlap() { }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ - &COMMAND_TOGGLE, &COMMAND_TOGGLE, &PANE_MODE, &SPLIT_RIGHT_IN_PANE_MODE, diff --git a/src/tests/integration/move_focus_up.rs b/src/tests/integration/move_focus_up.rs index fcfedb18..8af7a91d 100644 --- a/src/tests/integration/move_focus_up.rs +++ b/src/tests/integration/move_focus_up.rs @@ -24,7 +24,6 @@ pub fn move_focus_up() { }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ - &COMMAND_TOGGLE, &COMMAND_TOGGLE, &PANE_MODE, &SPLIT_DOWN_IN_PANE_MODE, @@ -54,7 +53,6 @@ pub fn move_focus_up_to_the_largest_overlap() { }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ - &COMMAND_TOGGLE, &COMMAND_TOGGLE, &PANE_MODE, &SPLIT_DOWN_IN_PANE_MODE, diff --git a/src/tests/integration/resize_down.rs b/src/tests/integration/resize_down.rs index ec0221cb..8bd274c2 100644 --- a/src/tests/integration/resize_down.rs +++ b/src/tests/integration/resize_down.rs @@ -33,13 +33,10 @@ pub fn resize_down_with_pane_above() { }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ - &COMMAND_TOGGLE, &COMMAND_TOGGLE, &PANE_MODE, &SPLIT_DOWN_IN_PANE_MODE, &ESC, - &COMMAND_TOGGLE, - &COMMAND_TOGGLE, &RESIZE_MODE, &RESIZE_DOWN_IN_RESIZE_MODE, &QUIT, @@ -75,14 +72,11 @@ pub fn resize_down_with_pane_below() { }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ - &COMMAND_TOGGLE, &COMMAND_TOGGLE, &PANE_MODE, &SPLIT_DOWN_IN_PANE_MODE, &MOVE_FOCUS_IN_PANE_MODE, &ESC, - &COMMAND_TOGGLE, - &COMMAND_TOGGLE, &RESIZE_MODE, &RESIZE_DOWN_IN_RESIZE_MODE, &QUIT, @@ -121,7 +115,6 @@ pub fn resize_down_with_panes_above_and_below() { }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ - &COMMAND_TOGGLE, &COMMAND_TOGGLE, &PANE_MODE, &SPLIT_DOWN_IN_PANE_MODE, @@ -129,8 +122,6 @@ pub fn resize_down_with_panes_above_and_below() { &MOVE_FOCUS_IN_PANE_MODE, &MOVE_FOCUS_IN_PANE_MODE, &ESC, - &COMMAND_TOGGLE, - &COMMAND_TOGGLE, &RESIZE_MODE, &RESIZE_DOWN_IN_RESIZE_MODE, &QUIT, @@ -167,7 +158,6 @@ pub fn resize_down_with_multiple_panes_above() { let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ - &COMMAND_TOGGLE, &COMMAND_TOGGLE, &PANE_MODE, &SPLIT_DOWN_IN_PANE_MODE, @@ -176,8 +166,6 @@ pub fn resize_down_with_multiple_panes_above() { &MOVE_FOCUS_IN_PANE_MODE, &MOVE_FOCUS_IN_PANE_MODE, &ESC, - &COMMAND_TOGGLE, - &COMMAND_TOGGLE, &RESIZE_MODE, &RESIZE_DOWN_IN_RESIZE_MODE, &QUIT, @@ -215,7 +203,6 @@ pub fn resize_down_with_panes_above_aligned_left_with_current_pane() { let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ - &COMMAND_TOGGLE, &COMMAND_TOGGLE, &PANE_MODE, &SPLIT_RIGHT_IN_PANE_MODE, @@ -226,8 +213,6 @@ pub fn resize_down_with_panes_above_aligned_left_with_current_pane() { &MOVE_FOCUS_IN_PANE_MODE, &MOVE_FOCUS_IN_PANE_MODE, &ESC, - &COMMAND_TOGGLE, - &COMMAND_TOGGLE, &RESIZE_MODE, &RESIZE_DOWN_IN_RESIZE_MODE, &QUIT, @@ -265,7 +250,6 @@ pub fn resize_down_with_panes_below_aligned_left_with_current_pane() { let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ - &COMMAND_TOGGLE, &COMMAND_TOGGLE, &PANE_MODE, &SPLIT_RIGHT_IN_PANE_MODE, @@ -275,8 +259,6 @@ pub fn resize_down_with_panes_below_aligned_left_with_current_pane() { &MOVE_FOCUS_IN_PANE_MODE, &MOVE_FOCUS_IN_PANE_MODE, &ESC, - &COMMAND_TOGGLE, - &COMMAND_TOGGLE, &RESIZE_MODE, &RESIZE_DOWN_IN_RESIZE_MODE, &QUIT, @@ -314,7 +296,6 @@ pub fn resize_down_with_panes_above_aligned_right_with_current_pane() { let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ - &COMMAND_TOGGLE, &COMMAND_TOGGLE, &PANE_MODE, &SPLIT_RIGHT_IN_PANE_MODE, @@ -322,8 +303,6 @@ pub fn resize_down_with_panes_above_aligned_right_with_current_pane() { &MOVE_FOCUS_IN_PANE_MODE, &SPLIT_DOWN_IN_PANE_MODE, &ESC, - &COMMAND_TOGGLE, - &COMMAND_TOGGLE, &RESIZE_MODE, &RESIZE_DOWN_IN_RESIZE_MODE, &QUIT, @@ -361,7 +340,6 @@ pub fn resize_down_with_panes_below_aligned_right_with_current_pane() { let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ - &COMMAND_TOGGLE, &COMMAND_TOGGLE, &PANE_MODE, &SPLIT_RIGHT_IN_PANE_MODE, @@ -370,8 +348,6 @@ pub fn resize_down_with_panes_below_aligned_right_with_current_pane() { &SPLIT_DOWN_IN_PANE_MODE, &MOVE_FOCUS_IN_PANE_MODE, &ESC, - &COMMAND_TOGGLE, - &COMMAND_TOGGLE, &RESIZE_MODE, &RESIZE_DOWN_IN_RESIZE_MODE, &QUIT, @@ -409,7 +385,6 @@ pub fn resize_down_with_panes_above_aligned_left_and_right_with_current_pane() { let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ - &COMMAND_TOGGLE, &COMMAND_TOGGLE, &PANE_MODE, &SPLIT_RIGHT_IN_PANE_MODE, @@ -421,8 +396,6 @@ pub fn resize_down_with_panes_above_aligned_left_and_right_with_current_pane() { &MOVE_FOCUS_IN_PANE_MODE, &SPLIT_DOWN_IN_PANE_MODE, &ESC, - &COMMAND_TOGGLE, - &COMMAND_TOGGLE, &RESIZE_MODE, &RESIZE_DOWN_IN_RESIZE_MODE, &QUIT, @@ -460,7 +433,6 @@ pub fn resize_down_with_panes_below_aligned_left_and_right_with_current_pane() { let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ - &COMMAND_TOGGLE, &COMMAND_TOGGLE, &PANE_MODE, &SPLIT_RIGHT_IN_PANE_MODE, @@ -474,8 +446,6 @@ pub fn resize_down_with_panes_below_aligned_left_and_right_with_current_pane() { &MOVE_FOCUS_IN_PANE_MODE, &MOVE_FOCUS_IN_PANE_MODE, &ESC, - &COMMAND_TOGGLE, - &COMMAND_TOGGLE, &RESIZE_MODE, &RESIZE_DOWN_IN_RESIZE_MODE, &QUIT, @@ -513,22 +483,17 @@ pub fn resize_down_with_panes_above_aligned_left_and_right_with_panes_to_the_lef let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ - &COMMAND_TOGGLE, &COMMAND_TOGGLE, &PANE_MODE, &SPLIT_RIGHT_IN_PANE_MODE, &SPLIT_RIGHT_IN_PANE_MODE, &MOVE_FOCUS_IN_PANE_MODE, &ESC, - &COMMAND_TOGGLE, - &COMMAND_TOGGLE, &RESIZE_MODE, &RESIZE_LEFT_IN_RESIZE_MODE, &RESIZE_LEFT_IN_RESIZE_MODE, &RESIZE_LEFT_IN_RESIZE_MODE, &ESC, - &COMMAND_TOGGLE, - &COMMAND_TOGGLE, &PANE_MODE, &SPLIT_DOWN_IN_PANE_MODE, &MOVE_FOCUS_IN_PANE_MODE, @@ -548,8 +513,6 @@ pub fn resize_down_with_panes_above_aligned_left_and_right_with_panes_to_the_lef &MOVE_FOCUS_IN_PANE_MODE, &MOVE_FOCUS_IN_PANE_MODE, &ESC, - &COMMAND_TOGGLE, - &COMMAND_TOGGLE, &RESIZE_MODE, &RESIZE_LEFT_IN_RESIZE_MODE, &RESIZE_LEFT_IN_RESIZE_MODE, @@ -589,22 +552,17 @@ pub fn resize_down_with_panes_below_aligned_left_and_right_with_to_the_left_and_ let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ - &COMMAND_TOGGLE, &COMMAND_TOGGLE, &PANE_MODE, &SPLIT_RIGHT_IN_PANE_MODE, &SPLIT_RIGHT_IN_PANE_MODE, &MOVE_FOCUS_IN_PANE_MODE, &ESC, - &COMMAND_TOGGLE, - &COMMAND_TOGGLE, &RESIZE_MODE, &RESIZE_LEFT_IN_RESIZE_MODE, &RESIZE_LEFT_IN_RESIZE_MODE, &RESIZE_LEFT_IN_RESIZE_MODE, &ESC, - &COMMAND_TOGGLE, - &COMMAND_TOGGLE, &PANE_MODE, &SPLIT_DOWN_IN_PANE_MODE, &MOVE_FOCUS_IN_PANE_MODE, @@ -626,8 +584,6 @@ pub fn resize_down_with_panes_below_aligned_left_and_right_with_to_the_left_and_ &MOVE_FOCUS_IN_PANE_MODE, &MOVE_FOCUS_IN_PANE_MODE, &ESC, - &COMMAND_TOGGLE, - &COMMAND_TOGGLE, &RESIZE_MODE, &RESIZE_LEFT_IN_RESIZE_MODE, &RESIZE_LEFT_IN_RESIZE_MODE, @@ -664,13 +620,10 @@ pub fn cannot_resize_down_when_pane_below_is_at_minimum_height() { }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ - &COMMAND_TOGGLE, &COMMAND_TOGGLE, &PANE_MODE, &SPLIT_DOWN_IN_PANE_MODE, &ESC, - &COMMAND_TOGGLE, - &COMMAND_TOGGLE, &RESIZE_MODE, &RESIZE_DOWN_IN_RESIZE_MODE, &QUIT, diff --git a/src/tests/integration/resize_left.rs b/src/tests/integration/resize_left.rs index 9645a4ec..948b5d30 100644 --- a/src/tests/integration/resize_left.rs +++ b/src/tests/integration/resize_left.rs @@ -30,13 +30,10 @@ pub fn resize_left_with_pane_to_the_left() { }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ - &COMMAND_TOGGLE, &COMMAND_TOGGLE, &PANE_MODE, &SPLIT_RIGHT_IN_PANE_MODE, &ESC, - &COMMAND_TOGGLE, - &COMMAND_TOGGLE, &RESIZE_MODE, &RESIZE_LEFT_IN_RESIZE_MODE, &QUIT, @@ -70,14 +67,11 @@ pub fn resize_left_with_pane_to_the_right() { }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ - &COMMAND_TOGGLE, &COMMAND_TOGGLE, &PANE_MODE, &SPLIT_RIGHT_IN_PANE_MODE, &MOVE_FOCUS_IN_PANE_MODE, &ESC, - &COMMAND_TOGGLE, - &COMMAND_TOGGLE, &RESIZE_MODE, &RESIZE_LEFT_IN_RESIZE_MODE, &QUIT, @@ -111,7 +105,6 @@ pub fn resize_left_with_panes_to_the_left_and_right() { }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ - &COMMAND_TOGGLE, &COMMAND_TOGGLE, &PANE_MODE, &SPLIT_RIGHT_IN_PANE_MODE, @@ -119,8 +112,6 @@ pub fn resize_left_with_panes_to_the_left_and_right() { &MOVE_FOCUS_IN_PANE_MODE, &MOVE_FOCUS_IN_PANE_MODE, &ESC, - &COMMAND_TOGGLE, - &COMMAND_TOGGLE, &RESIZE_MODE, &RESIZE_LEFT_IN_RESIZE_MODE, &QUIT, @@ -155,7 +146,6 @@ pub fn resize_left_with_multiple_panes_to_the_left() { let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ - &COMMAND_TOGGLE, &COMMAND_TOGGLE, &PANE_MODE, &SPLIT_RIGHT_IN_PANE_MODE, @@ -164,8 +154,6 @@ pub fn resize_left_with_multiple_panes_to_the_left() { &MOVE_FOCUS_IN_PANE_MODE, &MOVE_FOCUS_IN_PANE_MODE, &ESC, - &COMMAND_TOGGLE, - &COMMAND_TOGGLE, &RESIZE_MODE, &RESIZE_LEFT_IN_RESIZE_MODE, &QUIT, @@ -201,7 +189,6 @@ pub fn resize_left_with_panes_to_the_left_aligned_top_with_current_pane() { let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ - &COMMAND_TOGGLE, &COMMAND_TOGGLE, &PANE_MODE, &SPLIT_RIGHT_IN_PANE_MODE, @@ -212,8 +199,6 @@ pub fn resize_left_with_panes_to_the_left_aligned_top_with_current_pane() { &MOVE_FOCUS_IN_PANE_MODE, &MOVE_FOCUS_IN_PANE_MODE, &ESC, - &COMMAND_TOGGLE, - &COMMAND_TOGGLE, &RESIZE_MODE, &RESIZE_LEFT_IN_RESIZE_MODE, &QUIT, @@ -249,7 +234,6 @@ pub fn resize_left_with_panes_to_the_right_aligned_top_with_current_pane() { let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ - &COMMAND_TOGGLE, &COMMAND_TOGGLE, &PANE_MODE, &SPLIT_RIGHT_IN_PANE_MODE, @@ -257,8 +241,6 @@ pub fn resize_left_with_panes_to_the_right_aligned_top_with_current_pane() { &MOVE_FOCUS_IN_PANE_MODE, &SPLIT_DOWN_IN_PANE_MODE, &ESC, - &COMMAND_TOGGLE, - &COMMAND_TOGGLE, &RESIZE_MODE, &RESIZE_LEFT_IN_RESIZE_MODE, &QUIT, @@ -294,7 +276,6 @@ pub fn resize_left_with_panes_to_the_left_aligned_bottom_with_current_pane() { let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ - &COMMAND_TOGGLE, &COMMAND_TOGGLE, &PANE_MODE, &SPLIT_RIGHT_IN_PANE_MODE, @@ -304,8 +285,6 @@ pub fn resize_left_with_panes_to_the_left_aligned_bottom_with_current_pane() { &MOVE_FOCUS_IN_PANE_MODE, &MOVE_FOCUS_IN_PANE_MODE, &ESC, - &COMMAND_TOGGLE, - &COMMAND_TOGGLE, &RESIZE_MODE, &RESIZE_LEFT_IN_RESIZE_MODE, &QUIT, @@ -341,7 +320,6 @@ pub fn resize_left_with_panes_to_the_right_aligned_bottom_with_current_pane() { let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ - &COMMAND_TOGGLE, &COMMAND_TOGGLE, &PANE_MODE, &SPLIT_RIGHT_IN_PANE_MODE, @@ -350,8 +328,6 @@ pub fn resize_left_with_panes_to_the_right_aligned_bottom_with_current_pane() { &SPLIT_DOWN_IN_PANE_MODE, &MOVE_FOCUS_IN_PANE_MODE, &ESC, - &COMMAND_TOGGLE, - &COMMAND_TOGGLE, &RESIZE_MODE, &RESIZE_LEFT_IN_RESIZE_MODE, &QUIT, @@ -389,7 +365,6 @@ pub fn resize_left_with_panes_to_the_left_aligned_top_and_bottom_with_current_pa let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ - &COMMAND_TOGGLE, &COMMAND_TOGGLE, &PANE_MODE, &SPLIT_DOWN_IN_PANE_MODE, @@ -401,8 +376,6 @@ pub fn resize_left_with_panes_to_the_left_aligned_top_and_bottom_with_current_pa &MOVE_FOCUS_IN_PANE_MODE, &SPLIT_RIGHT_IN_PANE_MODE, &ESC, - &COMMAND_TOGGLE, - &COMMAND_TOGGLE, &RESIZE_MODE, &RESIZE_LEFT_IN_RESIZE_MODE, &QUIT, @@ -440,7 +413,6 @@ pub fn resize_left_with_panes_to_the_right_aligned_top_and_bottom_with_current_p let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ - &COMMAND_TOGGLE, &COMMAND_TOGGLE, &PANE_MODE, &SPLIT_DOWN_IN_PANE_MODE, @@ -454,8 +426,6 @@ pub fn resize_left_with_panes_to_the_right_aligned_top_and_bottom_with_current_p &MOVE_FOCUS_IN_PANE_MODE, &MOVE_FOCUS_IN_PANE_MODE, &ESC, - &COMMAND_TOGGLE, - &COMMAND_TOGGLE, &RESIZE_MODE, &RESIZE_LEFT_IN_RESIZE_MODE, &QUIT, @@ -493,22 +463,17 @@ pub fn resize_left_with_panes_to_the_left_aligned_top_and_bottom_with_panes_abov let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ - &COMMAND_TOGGLE, &COMMAND_TOGGLE, &PANE_MODE, &SPLIT_DOWN_IN_PANE_MODE, &SPLIT_DOWN_IN_PANE_MODE, &MOVE_FOCUS_IN_PANE_MODE, &ESC, - &COMMAND_TOGGLE, - &COMMAND_TOGGLE, &RESIZE_MODE, &RESIZE_UP_IN_RESIZE_MODE, &RESIZE_UP_IN_RESIZE_MODE, &RESIZE_UP_IN_RESIZE_MODE, &ESC, - &COMMAND_TOGGLE, - &COMMAND_TOGGLE, &PANE_MODE, &SPLIT_RIGHT_IN_PANE_MODE, &MOVE_FOCUS_IN_PANE_MODE, @@ -528,8 +493,6 @@ pub fn resize_left_with_panes_to_the_left_aligned_top_and_bottom_with_panes_abov &MOVE_FOCUS_IN_PANE_MODE, &MOVE_FOCUS_IN_PANE_MODE, &ESC, - &COMMAND_TOGGLE, - &COMMAND_TOGGLE, &RESIZE_MODE, &RESIZE_UP_IN_RESIZE_MODE, &RESIZE_UP_IN_RESIZE_MODE, @@ -570,22 +533,17 @@ pub fn resize_left_with_panes_to_the_right_aligned_top_and_bottom_with_panes_abo let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ - &COMMAND_TOGGLE, &COMMAND_TOGGLE, &PANE_MODE, &SPLIT_DOWN_IN_PANE_MODE, &SPLIT_DOWN_IN_PANE_MODE, &MOVE_FOCUS_IN_PANE_MODE, &ESC, - &COMMAND_TOGGLE, - &COMMAND_TOGGLE, &RESIZE_MODE, &RESIZE_UP_IN_RESIZE_MODE, &RESIZE_UP_IN_RESIZE_MODE, &RESIZE_UP_IN_RESIZE_MODE, &ESC, - &COMMAND_TOGGLE, - &COMMAND_TOGGLE, &PANE_MODE, &SPLIT_RIGHT_IN_PANE_MODE, &MOVE_FOCUS_IN_PANE_MODE, @@ -607,8 +565,6 @@ pub fn resize_left_with_panes_to_the_right_aligned_top_and_bottom_with_panes_abo &MOVE_FOCUS_IN_PANE_MODE, &MOVE_FOCUS_IN_PANE_MODE, &ESC, - &COMMAND_TOGGLE, - &COMMAND_TOGGLE, &RESIZE_MODE, &RESIZE_UP_IN_RESIZE_MODE, &RESIZE_UP_IN_RESIZE_MODE, @@ -645,13 +601,10 @@ pub fn cannot_resize_left_when_pane_to_the_left_is_at_minimum_width() { }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ - &COMMAND_TOGGLE, &COMMAND_TOGGLE, &PANE_MODE, &SPLIT_RIGHT_IN_PANE_MODE, &ESC, - &COMMAND_TOGGLE, - &COMMAND_TOGGLE, &RESIZE_MODE, &RESIZE_LEFT_IN_RESIZE_MODE, &QUIT, diff --git a/src/tests/integration/resize_right.rs b/src/tests/integration/resize_right.rs index cea8ecda..d1eac8bf 100644 --- a/src/tests/integration/resize_right.rs +++ b/src/tests/integration/resize_right.rs @@ -31,13 +31,10 @@ pub fn resize_right_with_pane_to_the_left() { }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ - &COMMAND_TOGGLE, &COMMAND_TOGGLE, &PANE_MODE, &SPLIT_RIGHT_IN_PANE_MODE, &ESC, - &COMMAND_TOGGLE, - &COMMAND_TOGGLE, &RESIZE_MODE, &RESIZE_RIGHT_IN_RESIZE_MODE, &QUIT, @@ -71,14 +68,11 @@ pub fn resize_right_with_pane_to_the_right() { }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ - &COMMAND_TOGGLE, &COMMAND_TOGGLE, &PANE_MODE, &SPLIT_RIGHT_IN_PANE_MODE, &MOVE_FOCUS_IN_PANE_MODE, &ESC, - &COMMAND_TOGGLE, - &COMMAND_TOGGLE, &RESIZE_MODE, &RESIZE_RIGHT_IN_RESIZE_MODE, &QUIT, @@ -112,7 +106,6 @@ pub fn resize_right_with_panes_to_the_left_and_right() { }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ - &COMMAND_TOGGLE, &COMMAND_TOGGLE, &PANE_MODE, &SPLIT_RIGHT_IN_PANE_MODE, @@ -120,8 +113,6 @@ pub fn resize_right_with_panes_to_the_left_and_right() { &MOVE_FOCUS_IN_PANE_MODE, &MOVE_FOCUS_IN_PANE_MODE, &ESC, - &COMMAND_TOGGLE, - &COMMAND_TOGGLE, &RESIZE_MODE, &RESIZE_RIGHT_IN_RESIZE_MODE, &QUIT, @@ -156,7 +147,6 @@ pub fn resize_right_with_multiple_panes_to_the_left() { let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ - &COMMAND_TOGGLE, &COMMAND_TOGGLE, &PANE_MODE, &SPLIT_RIGHT_IN_PANE_MODE, @@ -165,8 +155,6 @@ pub fn resize_right_with_multiple_panes_to_the_left() { &MOVE_FOCUS_IN_PANE_MODE, &MOVE_FOCUS_IN_PANE_MODE, &ESC, - &COMMAND_TOGGLE, - &COMMAND_TOGGLE, &RESIZE_MODE, &RESIZE_RIGHT_IN_RESIZE_MODE, &QUIT, @@ -202,7 +190,6 @@ pub fn resize_right_with_panes_to_the_left_aligned_top_with_current_pane() { let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ - &COMMAND_TOGGLE, &COMMAND_TOGGLE, &PANE_MODE, &SPLIT_RIGHT_IN_PANE_MODE, @@ -213,8 +200,6 @@ pub fn resize_right_with_panes_to_the_left_aligned_top_with_current_pane() { &MOVE_FOCUS_IN_PANE_MODE, &MOVE_FOCUS_IN_PANE_MODE, &ESC, - &COMMAND_TOGGLE, - &COMMAND_TOGGLE, &RESIZE_MODE, &RESIZE_RIGHT_IN_RESIZE_MODE, &QUIT, @@ -250,7 +235,6 @@ pub fn resize_right_with_panes_to_the_right_aligned_top_with_current_pane() { let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ - &COMMAND_TOGGLE, &COMMAND_TOGGLE, &PANE_MODE, &SPLIT_RIGHT_IN_PANE_MODE, @@ -258,8 +242,6 @@ pub fn resize_right_with_panes_to_the_right_aligned_top_with_current_pane() { &MOVE_FOCUS_IN_PANE_MODE, &SPLIT_DOWN_IN_PANE_MODE, &ESC, - &COMMAND_TOGGLE, - &COMMAND_TOGGLE, &RESIZE_MODE, &RESIZE_RIGHT_IN_RESIZE_MODE, &QUIT, @@ -295,7 +277,6 @@ pub fn resize_right_with_panes_to_the_left_aligned_bottom_with_current_pane() { let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ - &COMMAND_TOGGLE, &COMMAND_TOGGLE, &PANE_MODE, &SPLIT_RIGHT_IN_PANE_MODE, @@ -305,8 +286,6 @@ pub fn resize_right_with_panes_to_the_left_aligned_bottom_with_current_pane() { &MOVE_FOCUS_IN_PANE_MODE, &MOVE_FOCUS_IN_PANE_MODE, &ESC, - &COMMAND_TOGGLE, - &COMMAND_TOGGLE, &RESIZE_MODE, &RESIZE_RIGHT_IN_RESIZE_MODE, &QUIT, @@ -342,7 +321,6 @@ pub fn resize_right_with_panes_to_the_right_aligned_bottom_with_current_pane() { let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ - &COMMAND_TOGGLE, &COMMAND_TOGGLE, &PANE_MODE, &SPLIT_RIGHT_IN_PANE_MODE, @@ -351,8 +329,6 @@ pub fn resize_right_with_panes_to_the_right_aligned_bottom_with_current_pane() { &SPLIT_DOWN_IN_PANE_MODE, &MOVE_FOCUS_IN_PANE_MODE, &ESC, - &COMMAND_TOGGLE, - &COMMAND_TOGGLE, &RESIZE_MODE, &RESIZE_RIGHT_IN_RESIZE_MODE, &QUIT, @@ -390,7 +366,6 @@ pub fn resize_right_with_panes_to_the_left_aligned_top_and_bottom_with_current_p let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ - &COMMAND_TOGGLE, &COMMAND_TOGGLE, &PANE_MODE, &SPLIT_DOWN_IN_PANE_MODE, @@ -402,8 +377,6 @@ pub fn resize_right_with_panes_to_the_left_aligned_top_and_bottom_with_current_p &MOVE_FOCUS_IN_PANE_MODE, &SPLIT_RIGHT_IN_PANE_MODE, &ESC, - &COMMAND_TOGGLE, - &COMMAND_TOGGLE, &RESIZE_MODE, &RESIZE_RIGHT_IN_RESIZE_MODE, &QUIT, @@ -441,7 +414,6 @@ pub fn resize_right_with_panes_to_the_right_aligned_top_and_bottom_with_current_ let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ - &COMMAND_TOGGLE, &COMMAND_TOGGLE, &PANE_MODE, &SPLIT_DOWN_IN_PANE_MODE, @@ -455,8 +427,6 @@ pub fn resize_right_with_panes_to_the_right_aligned_top_and_bottom_with_current_ &MOVE_FOCUS_IN_PANE_MODE, &MOVE_FOCUS_IN_PANE_MODE, &ESC, - &COMMAND_TOGGLE, - &COMMAND_TOGGLE, &RESIZE_MODE, &RESIZE_RIGHT_IN_RESIZE_MODE, &QUIT, @@ -494,22 +464,17 @@ pub fn resize_right_with_panes_to_the_left_aligned_top_and_bottom_with_panes_abo let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ - &COMMAND_TOGGLE, &COMMAND_TOGGLE, &PANE_MODE, &SPLIT_DOWN_IN_PANE_MODE, &SPLIT_DOWN_IN_PANE_MODE, &MOVE_FOCUS_IN_PANE_MODE, &ESC, - &COMMAND_TOGGLE, - &COMMAND_TOGGLE, &RESIZE_MODE, &RESIZE_UP_IN_RESIZE_MODE, &RESIZE_UP_IN_RESIZE_MODE, &RESIZE_UP_IN_RESIZE_MODE, &ESC, - &COMMAND_TOGGLE, - &COMMAND_TOGGLE, &PANE_MODE, &SPLIT_RIGHT_IN_PANE_MODE, &MOVE_FOCUS_IN_PANE_MODE, @@ -529,8 +494,6 @@ pub fn resize_right_with_panes_to_the_left_aligned_top_and_bottom_with_panes_abo &MOVE_FOCUS_IN_PANE_MODE, &MOVE_FOCUS_IN_PANE_MODE, &ESC, - &COMMAND_TOGGLE, - &COMMAND_TOGGLE, &RESIZE_MODE, &RESIZE_UP_IN_RESIZE_MODE, &RESIZE_UP_IN_RESIZE_MODE, @@ -570,22 +533,17 @@ pub fn resize_right_with_panes_to_the_right_aligned_top_and_bottom_with_panes_ab let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ - &COMMAND_TOGGLE, &COMMAND_TOGGLE, &PANE_MODE, &SPLIT_DOWN_IN_PANE_MODE, &SPLIT_DOWN_IN_PANE_MODE, &MOVE_FOCUS_IN_PANE_MODE, &ESC, - &COMMAND_TOGGLE, - &COMMAND_TOGGLE, &RESIZE_MODE, &RESIZE_UP_IN_RESIZE_MODE, &RESIZE_UP_IN_RESIZE_MODE, &RESIZE_UP_IN_RESIZE_MODE, &ESC, - &COMMAND_TOGGLE, - &COMMAND_TOGGLE, &PANE_MODE, &SPLIT_RIGHT_IN_PANE_MODE, &MOVE_FOCUS_IN_PANE_MODE, @@ -607,8 +565,6 @@ pub fn resize_right_with_panes_to_the_right_aligned_top_and_bottom_with_panes_ab &MOVE_FOCUS_IN_PANE_MODE, &MOVE_FOCUS_IN_PANE_MODE, &ESC, - &COMMAND_TOGGLE, - &COMMAND_TOGGLE, &RESIZE_MODE, &RESIZE_UP_IN_RESIZE_MODE, &RESIZE_UP_IN_RESIZE_MODE, @@ -645,13 +601,10 @@ pub fn cannot_resize_right_when_pane_to_the_left_is_at_minimum_width() { }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ - &COMMAND_TOGGLE, &COMMAND_TOGGLE, &PANE_MODE, &SPLIT_RIGHT_IN_PANE_MODE, &ESC, - &COMMAND_TOGGLE, - &COMMAND_TOGGLE, &RESIZE_MODE, &RESIZE_RIGHT_IN_RESIZE_MODE, &QUIT, diff --git a/src/tests/integration/resize_up.rs b/src/tests/integration/resize_up.rs index 6e9f7813..20b70c42 100644 --- a/src/tests/integration/resize_up.rs +++ b/src/tests/integration/resize_up.rs @@ -32,13 +32,10 @@ pub fn resize_up_with_pane_above() { }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ - &COMMAND_TOGGLE, &COMMAND_TOGGLE, &PANE_MODE, &SPLIT_DOWN_IN_PANE_MODE, &ESC, - &COMMAND_TOGGLE, - &COMMAND_TOGGLE, &RESIZE_MODE, &RESIZE_UP_IN_RESIZE_MODE, &QUIT, @@ -74,14 +71,11 @@ pub fn resize_up_with_pane_below() { }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ - &COMMAND_TOGGLE, &COMMAND_TOGGLE, &PANE_MODE, &SPLIT_DOWN_IN_PANE_MODE, &MOVE_FOCUS_IN_PANE_MODE, &ESC, - &COMMAND_TOGGLE, - &COMMAND_TOGGLE, &RESIZE_MODE, &RESIZE_UP_IN_RESIZE_MODE, &QUIT, @@ -120,7 +114,6 @@ pub fn resize_up_with_panes_above_and_below() { }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ - &COMMAND_TOGGLE, &COMMAND_TOGGLE, &PANE_MODE, &SPLIT_DOWN_IN_PANE_MODE, @@ -128,8 +121,6 @@ pub fn resize_up_with_panes_above_and_below() { &MOVE_FOCUS_IN_PANE_MODE, &MOVE_FOCUS_IN_PANE_MODE, &ESC, - &COMMAND_TOGGLE, - &COMMAND_TOGGLE, &RESIZE_MODE, &RESIZE_UP_IN_RESIZE_MODE, &QUIT, @@ -165,7 +156,6 @@ pub fn resize_up_with_multiple_panes_above() { let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ - &COMMAND_TOGGLE, &COMMAND_TOGGLE, &PANE_MODE, &SPLIT_DOWN_IN_PANE_MODE, @@ -174,8 +164,6 @@ pub fn resize_up_with_multiple_panes_above() { &MOVE_FOCUS_IN_PANE_MODE, &MOVE_FOCUS_IN_PANE_MODE, &ESC, - &COMMAND_TOGGLE, - &COMMAND_TOGGLE, &RESIZE_MODE, &RESIZE_UP_IN_RESIZE_MODE, &QUIT, @@ -211,7 +199,6 @@ pub fn resize_up_with_panes_above_aligned_left_with_current_pane() { let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ - &COMMAND_TOGGLE, &COMMAND_TOGGLE, &PANE_MODE, &SPLIT_RIGHT_IN_PANE_MODE, @@ -222,8 +209,6 @@ pub fn resize_up_with_panes_above_aligned_left_with_current_pane() { &MOVE_FOCUS_IN_PANE_MODE, &MOVE_FOCUS_IN_PANE_MODE, &ESC, - &COMMAND_TOGGLE, - &COMMAND_TOGGLE, &RESIZE_MODE, &RESIZE_UP_IN_RESIZE_MODE, &QUIT, @@ -261,7 +246,6 @@ pub fn resize_up_with_panes_below_aligned_left_with_current_pane() { let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ - &COMMAND_TOGGLE, &COMMAND_TOGGLE, &PANE_MODE, &SPLIT_RIGHT_IN_PANE_MODE, @@ -271,8 +255,6 @@ pub fn resize_up_with_panes_below_aligned_left_with_current_pane() { &MOVE_FOCUS_IN_PANE_MODE, &MOVE_FOCUS_IN_PANE_MODE, &ESC, - &COMMAND_TOGGLE, - &COMMAND_TOGGLE, &RESIZE_MODE, &RESIZE_UP_IN_RESIZE_MODE, &QUIT, @@ -310,7 +292,6 @@ pub fn resize_up_with_panes_above_aligned_right_with_current_pane() { let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ - &COMMAND_TOGGLE, &COMMAND_TOGGLE, &PANE_MODE, &SPLIT_RIGHT_IN_PANE_MODE, @@ -318,8 +299,6 @@ pub fn resize_up_with_panes_above_aligned_right_with_current_pane() { &MOVE_FOCUS_IN_PANE_MODE, &SPLIT_DOWN_IN_PANE_MODE, &ESC, - &COMMAND_TOGGLE, - &COMMAND_TOGGLE, &RESIZE_MODE, &RESIZE_UP_IN_RESIZE_MODE, &QUIT, @@ -357,7 +336,6 @@ pub fn resize_up_with_panes_below_aligned_right_with_current_pane() { let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ - &COMMAND_TOGGLE, &COMMAND_TOGGLE, &PANE_MODE, &SPLIT_RIGHT_IN_PANE_MODE, @@ -366,8 +344,6 @@ pub fn resize_up_with_panes_below_aligned_right_with_current_pane() { &SPLIT_DOWN_IN_PANE_MODE, &MOVE_FOCUS_IN_PANE_MODE, &ESC, - &COMMAND_TOGGLE, - &COMMAND_TOGGLE, &RESIZE_MODE, &RESIZE_UP_IN_RESIZE_MODE, &QUIT, @@ -405,7 +381,6 @@ pub fn resize_up_with_panes_above_aligned_left_and_right_with_current_pane() { let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ - &COMMAND_TOGGLE, &COMMAND_TOGGLE, &PANE_MODE, &SPLIT_RIGHT_IN_PANE_MODE, @@ -417,8 +392,6 @@ pub fn resize_up_with_panes_above_aligned_left_and_right_with_current_pane() { &MOVE_FOCUS_IN_PANE_MODE, &SPLIT_DOWN_IN_PANE_MODE, &ESC, - &COMMAND_TOGGLE, - &COMMAND_TOGGLE, &RESIZE_MODE, &RESIZE_UP_IN_RESIZE_MODE, &QUIT, @@ -456,7 +429,6 @@ pub fn resize_up_with_panes_below_aligned_left_and_right_with_current_pane() { let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ - &COMMAND_TOGGLE, &COMMAND_TOGGLE, &PANE_MODE, &SPLIT_RIGHT_IN_PANE_MODE, @@ -470,8 +442,6 @@ pub fn resize_up_with_panes_below_aligned_left_and_right_with_current_pane() { &MOVE_FOCUS_IN_PANE_MODE, &MOVE_FOCUS_IN_PANE_MODE, &ESC, - &COMMAND_TOGGLE, - &COMMAND_TOGGLE, &RESIZE_MODE, &RESIZE_UP_IN_RESIZE_MODE, &QUIT, @@ -509,22 +479,17 @@ pub fn resize_up_with_panes_above_aligned_left_and_right_with_panes_to_the_left_ let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ - &COMMAND_TOGGLE, &COMMAND_TOGGLE, &PANE_MODE, &SPLIT_RIGHT_IN_PANE_MODE, &SPLIT_RIGHT_IN_PANE_MODE, &MOVE_FOCUS_IN_PANE_MODE, &ESC, - &COMMAND_TOGGLE, - &COMMAND_TOGGLE, &RESIZE_MODE, &RESIZE_LEFT_IN_RESIZE_MODE, &RESIZE_LEFT_IN_RESIZE_MODE, &RESIZE_LEFT_IN_RESIZE_MODE, &ESC, - &COMMAND_TOGGLE, - &COMMAND_TOGGLE, &PANE_MODE, &SPLIT_DOWN_IN_PANE_MODE, &MOVE_FOCUS_IN_PANE_MODE, @@ -544,8 +509,6 @@ pub fn resize_up_with_panes_above_aligned_left_and_right_with_panes_to_the_left_ &MOVE_FOCUS_IN_PANE_MODE, &MOVE_FOCUS_IN_PANE_MODE, &ESC, - &COMMAND_TOGGLE, - &COMMAND_TOGGLE, &RESIZE_MODE, &RESIZE_LEFT_IN_RESIZE_MODE, &RESIZE_LEFT_IN_RESIZE_MODE, @@ -585,22 +548,17 @@ pub fn resize_up_with_panes_below_aligned_left_and_right_with_to_the_left_and_ri let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ - &COMMAND_TOGGLE, &COMMAND_TOGGLE, &PANE_MODE, &SPLIT_RIGHT_IN_PANE_MODE, &SPLIT_RIGHT_IN_PANE_MODE, &MOVE_FOCUS_IN_PANE_MODE, &ESC, - &COMMAND_TOGGLE, - &COMMAND_TOGGLE, &RESIZE_MODE, &RESIZE_LEFT_IN_RESIZE_MODE, &RESIZE_LEFT_IN_RESIZE_MODE, &RESIZE_LEFT_IN_RESIZE_MODE, &ESC, - &COMMAND_TOGGLE, - &COMMAND_TOGGLE, &PANE_MODE, &SPLIT_DOWN_IN_PANE_MODE, &MOVE_FOCUS_IN_PANE_MODE, @@ -622,8 +580,6 @@ pub fn resize_up_with_panes_below_aligned_left_and_right_with_to_the_left_and_ri &MOVE_FOCUS_IN_PANE_MODE, &MOVE_FOCUS_IN_PANE_MODE, &ESC, - &COMMAND_TOGGLE, - &COMMAND_TOGGLE, &RESIZE_MODE, &RESIZE_LEFT_IN_RESIZE_MODE, &RESIZE_LEFT_IN_RESIZE_MODE, @@ -660,13 +616,10 @@ pub fn cannot_resize_up_when_pane_above_is_at_minimum_height() { }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ - &COMMAND_TOGGLE, &COMMAND_TOGGLE, &PANE_MODE, &SPLIT_DOWN_IN_PANE_MODE, &ESC, - &COMMAND_TOGGLE, - &COMMAND_TOGGLE, &RESIZE_MODE, &RESIZE_UP_IN_RESIZE_MODE, &QUIT, diff --git a/src/tests/integration/tabs.rs b/src/tests/integration/tabs.rs index a4a0f52a..17a0fc1b 100644 --- a/src/tests/integration/tabs.rs +++ b/src/tests/integration/tabs.rs @@ -25,13 +25,10 @@ pub fn open_new_tab() { }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ - &COMMAND_TOGGLE, &COMMAND_TOGGLE, &PANE_MODE, &SPLIT_DOWN_IN_PANE_MODE, &ESC, - &COMMAND_TOGGLE, - &COMMAND_TOGGLE, &TAB_MODE, &NEW_TAB_IN_TAB_MODE, &QUIT, @@ -59,13 +56,10 @@ pub fn switch_to_prev_tab() { }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ - &COMMAND_TOGGLE, &COMMAND_TOGGLE, &PANE_MODE, &SPLIT_DOWN_IN_PANE_MODE, &ESC, - &COMMAND_TOGGLE, - &COMMAND_TOGGLE, &TAB_MODE, &NEW_TAB_IN_TAB_MODE, &SWITCH_PREV_TAB_IN_TAB_MODE, @@ -94,13 +88,10 @@ pub fn switch_to_next_tab() { }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ - &COMMAND_TOGGLE, &COMMAND_TOGGLE, &PANE_MODE, &SPLIT_DOWN_IN_PANE_MODE, &ESC, - &COMMAND_TOGGLE, - &COMMAND_TOGGLE, &TAB_MODE, &NEW_TAB_IN_TAB_MODE, &SWITCH_NEXT_TAB_IN_TAB_MODE, @@ -129,13 +120,10 @@ pub fn close_tab() { }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ - &COMMAND_TOGGLE, &COMMAND_TOGGLE, &PANE_MODE, &SPLIT_DOWN_IN_PANE_MODE, &ESC, - &COMMAND_TOGGLE, - &COMMAND_TOGGLE, &TAB_MODE, &NEW_TAB_IN_TAB_MODE, &CLOSE_TAB_IN_TAB_MODE, @@ -164,13 +152,10 @@ pub fn close_last_pane_in_a_tab() { }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ - &COMMAND_TOGGLE, &COMMAND_TOGGLE, &TAB_MODE, &NEW_TAB_IN_TAB_MODE, &ESC, - &COMMAND_TOGGLE, - &COMMAND_TOGGLE, &PANE_MODE, &SPLIT_DOWN_IN_PANE_MODE, &CLOSE_PANE_IN_PANE_MODE, @@ -200,18 +185,13 @@ pub fn close_the_middle_tab() { }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ - &COMMAND_TOGGLE, &COMMAND_TOGGLE, &TAB_MODE, &NEW_TAB_IN_TAB_MODE, &ESC, - &COMMAND_TOGGLE, - &COMMAND_TOGGLE, &PANE_MODE, &SPLIT_DOWN_IN_PANE_MODE, &ESC, - &COMMAND_TOGGLE, - &COMMAND_TOGGLE, &TAB_MODE, &NEW_TAB_IN_TAB_MODE, &SWITCH_PREV_TAB_IN_TAB_MODE, @@ -241,34 +221,23 @@ pub fn close_the_tab_that_has_a_pane_in_fullscreen() { }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ - &COMMAND_TOGGLE, &COMMAND_TOGGLE, &PANE_MODE, &SPLIT_DOWN_IN_PANE_MODE, &ESC, - &COMMAND_TOGGLE, - &COMMAND_TOGGLE, &TAB_MODE, &NEW_TAB_IN_TAB_MODE, &ESC, - &COMMAND_TOGGLE, - &COMMAND_TOGGLE, &PANE_MODE, &SPLIT_DOWN_IN_PANE_MODE, &ESC, - &COMMAND_TOGGLE, - &COMMAND_TOGGLE, &TAB_MODE, &NEW_TAB_IN_TAB_MODE, &SWITCH_PREV_TAB_IN_TAB_MODE, &ESC, - &COMMAND_TOGGLE, - &COMMAND_TOGGLE, &PANE_MODE, &TOGGLE_ACTIVE_TERMINAL_FULLSCREEN_IN_PANE_MODE, &ESC, - &COMMAND_TOGGLE, - &COMMAND_TOGGLE, &TAB_MODE, &CLOSE_TAB_IN_TAB_MODE, &QUIT, @@ -296,13 +265,10 @@ pub fn closing_last_tab_exits_the_app() { }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ - &COMMAND_TOGGLE, &COMMAND_TOGGLE, &PANE_MODE, &SPLIT_DOWN_IN_PANE_MODE, &ESC, - &COMMAND_TOGGLE, - &COMMAND_TOGGLE, &TAB_MODE, &NEW_TAB_IN_TAB_MODE, &CLOSE_TAB_IN_TAB_MODE, diff --git a/src/tests/integration/toggle_fullscreen.rs b/src/tests/integration/toggle_fullscreen.rs index 943e91a5..3ac1103e 100644 --- a/src/tests/integration/toggle_fullscreen.rs +++ b/src/tests/integration/toggle_fullscreen.rs @@ -24,7 +24,6 @@ pub fn adding_new_terminal_in_fullscreen() { }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ - &COMMAND_TOGGLE, &COMMAND_TOGGLE, &PANE_MODE, &SPLIT_RIGHT_IN_PANE_MODE, @@ -55,7 +54,6 @@ pub fn move_focus_is_disabled_in_fullscreen() { }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ - &COMMAND_TOGGLE, &COMMAND_TOGGLE, &PANE_MODE, &SPLIT_RIGHT_IN_PANE_MODE, diff --git a/zellij-tile/src/shim.rs b/zellij-tile/src/shim.rs index b567cb81..52740472 100644 --- a/zellij-tile/src/shim.rs +++ b/zellij-tile/src/shim.rs @@ -27,7 +27,6 @@ pub enum Key { #[derive(Default, Debug, Clone, Serialize, Deserialize)] pub struct Help { pub mode: InputMode, - pub mode_is_persistent: bool, pub keybinds: Vec<(String, String)>, } @@ -36,7 +35,6 @@ pub struct Help { pub enum InputMode { Normal, Command, - CommandPersistent, Resize, Pane, Tab,