aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authordenis <denismaximov98@gmail.com>2021-03-17 10:05:43 +0200
committerdenis <denismaximov98@gmail.com>2021-03-17 10:05:43 +0200
commit448c426c2b8ca925f2a8016171988a5c824f66d3 (patch)
tree610d3f367fc78bdf73e37343118892f78c3f05ad /src
parentwip: need to debug somehow (diff)
parentPerformance: only render panes that should be updated (#234) (diff)
downloadsl0ppij-448c426c2b8ca925f2a8016171988a5c824f66d3.tar.gz
sl0ppij-448c426c2b8ca925f2a8016171988a5c824f66d3.tar.xz
sl0ppij-448c426c2b8ca925f2a8016171988a5c824f66d3.zip
Merge branch 'main' into focused-pane
Diffstat (limited to 'src')
-rw-r--r--src/client/layout.rs3
-rw-r--r--src/client/panes/terminal_pane.rs31
-rw-r--r--src/client/tab.rs30
-rw-r--r--src/common/errors.rs2
-rw-r--r--src/common/input/actions.rs2
-rw-r--r--src/common/input/handler.rs53
-rw-r--r--src/common/input/keybinds.rs175
-rw-r--r--src/common/mod.rs81
-rw-r--r--src/common/screen.rs49
-rw-r--r--src/common/wasm_vm.rs21
-rw-r--r--src/tests/fakes.rs11
-rw-r--r--src/tests/integration/basic.rs51
-rw-r--r--src/tests/integration/close_pane.rs25
-rw-r--r--src/tests/integration/compatibility.rs42
-rw-r--r--src/tests/integration/expansion_boundary.rs11
-rw-r--r--src/tests/integration/layouts.rs4
-rw-r--r--src/tests/integration/move_focus_down.rs4
-rw-r--r--src/tests/integration/move_focus_left.rs4
-rw-r--r--src/tests/integration/move_focus_right.rs4
-rw-r--r--src/tests/integration/move_focus_up.rs4
-rw-r--r--src/tests/integration/resize_down.rs48
-rw-r--r--src/tests/integration/resize_left.rs47
-rw-r--r--src/tests/integration/resize_right.rs48
-rw-r--r--src/tests/integration/resize_up.rs47
-rw-r--r--src/tests/integration/tabs.rs25
-rw-r--r--src/tests/integration/toggle_fullscreen.rs6
-rw-r--r--src/tests/utils.rs11
27 files changed, 443 insertions, 396 deletions
diff --git a/src/client/layout.rs b/src/client/layout.rs
index c032be38..1b383540 100644
--- a/src/client/layout.rs
+++ b/src/client/layout.rs
@@ -4,6 +4,7 @@ use serde::{Deserialize, Serialize};
use std::path::{Path, PathBuf};
use std::{fs::File, io::prelude::*};
+use crate::common::wasm_vm::EventType;
use crate::panes::PositionAndSize;
fn split_space_to_parts_vertically(
@@ -180,6 +181,8 @@ pub struct Layout {
pub plugin: Option<PathBuf>,
#[serde(default)]
pub expansion_boundary: bool,
+ #[serde(default, skip_serializing_if = "Vec::is_empty")]
+ pub events: Vec<EventType>,
}
impl Layout {
diff --git a/src/client/panes/terminal_pane.rs b/src/client/panes/terminal_pane.rs
index fd83d571..9fa70d11 100644
--- a/src/client/panes/terminal_pane.rs
+++ b/src/client/panes/terminal_pane.rs
@@ -70,13 +70,11 @@ impl Pane for TerminalPane {
fn reset_size_and_position_override(&mut self) {
self.position_and_size_override = None;
self.reflow_lines();
- self.mark_for_rerender();
}
fn change_pos_and_size(&mut self, position_and_size: &PositionAndSize) {
self.position_and_size.columns = position_and_size.columns;
self.position_and_size.rows = position_and_size.rows;
self.reflow_lines();
- self.mark_for_rerender();
}
fn override_size_and_position(&mut self, x: usize, y: usize, size: &PositionAndSize) {
let position_and_size_override = PositionAndSize {
@@ -87,7 +85,6 @@ impl Pane for TerminalPane {
};
self.position_and_size_override = Some(position_and_size_override);
self.reflow_lines();
- self.mark_for_rerender();
}
fn handle_event(&mut self, event: VteEvent) {
match event {
@@ -191,12 +188,7 @@ impl Pane for TerminalPane {
self.max_height
}
fn render(&mut self) -> Option<String> {
- // if self.should_render {
- if true {
- // while checking should_render rather than rendering each pane every time
- // is more performant, it causes some problems when the pane to the left should be
- // rendered and has wide characters (eg. Chinese characters or emoji)
- // as a (hopefully) temporary hack, we render all panes until we find a better solution
+ if self.should_render || cfg!(test) {
let mut vte_output = String::new();
let buffer_lines = &self.read_buffer_as_lines();
let display_cols = self.get_columns();
@@ -205,12 +197,11 @@ impl Pane for TerminalPane {
for line_index in 0..self.grid.height {
let x = self.get_x();
let y = self.get_y();
- vte_output = format!(
- "{}\u{1b}[{};{}H\u{1b}[m",
- vte_output,
+ vte_output.push_str(&format!(
+ "\u{1b}[{};{}H\u{1b}[m",
y + line_index + 1,
x + 1
- ); // goto row/col and reset styles
+ )); // goto row/col and reset styles
for _col_index in 0..self.grid.width {
vte_output.push(EMPTY_TERMINAL_CHARACTER.character);
}
@@ -220,7 +211,7 @@ impl Pane for TerminalPane {
for (row, line) in buffer_lines.iter().enumerate() {
let x = self.get_x();
let y = self.get_y();
- vte_output = format!("{}\u{1b}[{};{}H\u{1b}[m", vte_output, y + row + 1, x + 1); // goto row/col and reset styles
+ vte_output.push_str(&format!("\u{1b}[{};{}H\u{1b}[m", y + row + 1, x + 1)); // goto row/col and reset styles
for (col, t_character) in line.iter().enumerate() {
if col < display_cols {
// in some cases (eg. while resizing) some characters will spill over
@@ -232,14 +223,14 @@ impl Pane for TerminalPane {
// the terminal keeps the previous styles as long as we're in the same
// line, so we only want to update the new styles here (this also
// includes resetting previous styles as needed)
- vte_output = format!("{}{}", vte_output, new_styles);
+ vte_output.push_str(&new_styles.to_string());
}
vte_output.push(t_character.character);
}
}
character_styles.clear();
}
- self.mark_for_rerender();
+ self.should_render = false;
Some(vte_output)
} else {
None
@@ -252,45 +243,37 @@ impl Pane for TerminalPane {
self.position_and_size.y += count;
self.position_and_size.rows -= count;
self.reflow_lines();
- self.mark_for_rerender();
}
fn increase_height_down(&mut self, count: usize) {
self.position_and_size.rows += count;
self.reflow_lines();
- self.mark_for_rerender();
}
fn increase_height_up(&mut self, count: usize) {
self.position_and_size.y -= count;
self.position_and_size.rows += count;
self.reflow_lines();
- self.mark_for_rerender();
}
fn reduce_height_up(&mut self, count: usize) {
self.position_and_size.rows -= count;
self.reflow_lines();
- self.mark_for_rerender();
}
fn reduce_width_right(&mut self, count: usize) {
self.position_and_size.x += count;
self.position_and_size.columns -= count;
self.reflow_lines();
- self.mark_for_rerender();
}
fn reduce_width_left(&mut self, count: usize) {
self.position_and_size.columns -= count;
self.reflow_lines();
- self.mark_for_rerender();
}
fn increase_width_left(&mut self, count: usize) {
self.position_and_size.x -= count;
self.position_and_size.columns += count;
self.reflow_lines();
- self.mark_for_rerender();
}
fn increase_width_right(&mut self, count: usize) {
self.position_and_size.columns += count;
self.reflow_lines();
- self.mark_for_rerender();
}
fn scroll_up(&mut self, count: usize) {
self.grid.move_viewport_up(count);
diff --git a/src/client/tab.rs b/src/client/tab.rs
index d5c7f896..b7c43cf4 100644
--- a/src/client/tab.rs
+++ b/src/client/tab.rs
@@ -2,11 +2,13 @@
//! as well as how they should be resized
use crate::common::{AppInstruction, SenderWithContext};
+use crate::layout::Layout;
use crate::panes::{PaneId, PositionAndSize, TerminalPane};
use crate::pty_bus::{PtyInstruction, VteEvent};
+use crate::wasm_vm::{PluginInputType, PluginInstruction};
use crate::{boundaries::Boundaries, panes::PluginPane};
-use crate::{layout::Layout, wasm_vm::PluginInstruction};
use crate::{os_input_output::OsApi, utils::shared::pad_to_size};
+use serde::{Deserialize, Serialize};
use std::os::unix::io::RawFd;
use std::{
cmp::Reverse,
@@ -51,6 +53,7 @@ fn split_horizontally_with_gap(rect: &PositionAndSize) -> (PositionAndSize, Posi
pub struct Tab {
pub index: usize,
pub position: usize,
+ pub name: String,
panes: BTreeMap<PaneId, Box<dyn Pane>>,
panes_to_hide: HashSet<PaneId>,
active_terminal: Option<PaneId>,
@@ -64,6 +67,14 @@ pub struct Tab {
expansion_boundary: Option<PositionAndSize>,
}
+#[derive(Clone, Debug, Default, Serialize, Deserialize)]
+pub struct TabData {
+ /* subset of fields to publish to plugins */
+ pub position: usize,
+ pub name: String,
+ pub active: bool,
+}
+
// FIXME: Use a struct that has a pane_type enum, to reduce all of the duplication
pub trait Pane {
fn x(&self) -> usize;
@@ -170,6 +181,7 @@ impl Tab {
pub fn new(
index: usize,
position: usize,
+ name: String,
full_screen_ws: &PositionAndSize,
mut os_api: Box<dyn OsApi>,
send_pty_instructions: SenderWithContext<PtyInstruction>,
@@ -195,6 +207,7 @@ impl Tab {
index,
position,
panes,
+ name,
max_panes,
panes_to_hide: HashSet::new(),
active_terminal: pane_id,
@@ -249,7 +262,11 @@ impl Tab {
if let Some(plugin) = &layout.plugin {
let (pid_tx, pid_rx) = channel();
self.send_plugin_instructions
- .send(PluginInstruction::Load(pid_tx, plugin.clone()))
+ .send(PluginInstruction::Load(
+ pid_tx,
+ plugin.clone(),
+ layout.events.clone(),
+ ))
.unwrap();
let pid = pid_rx.recv().unwrap();
let new_plugin = PluginPane::new(
@@ -546,7 +563,10 @@ impl Tab {
}
Some(PaneId::Plugin(pid)) => {
self.send_plugin_instructions
- .send(PluginInstruction::Input(pid, input_bytes))
+ .send(PluginInstruction::Input(
+ PluginInputType::Normal(pid),
+ input_bytes,
+ ))
.unwrap();
}
_ => {}
@@ -1662,7 +1682,6 @@ impl Tab {
} else if self.can_reduce_pane_and_surroundings_right(&active_pane_id, count) {
self.reduce_pane_and_surroundings_right(&active_pane_id, count);
}
- self.render();
}
}
pub fn resize_left(&mut self) {
@@ -1674,7 +1693,6 @@ impl Tab {
} else if self.can_reduce_pane_and_surroundings_left(&active_pane_id, count) {
self.reduce_pane_and_surroundings_left(&active_pane_id, count);
}
- self.render();
}
}
pub fn resize_down(&mut self) {
@@ -1686,7 +1704,6 @@ impl Tab {
} else if self.can_reduce_pane_and_surroundings_down(&active_pane_id, count) {
self.reduce_pane_and_surroundings_down(&active_pane_id, count);
}
- self.render();
}
}
pub fn resize_up(&mut self) {
@@ -1698,7 +1715,6 @@ impl Tab {
} else if self.can_reduce_pane_and_surroundings_up(&active_pane_id, count) {
self.reduce_pane_and_surroundings_up(&active_pane_id, count);
}
- self.render();
}
}
pub fn move_focus(&mut self) {
diff --git a/src/common/errors.rs b/src/common/errors.rs
index 03aec714..df741629 100644
--- a/src/common/errors.rs
+++ b/src/common/errors.rs
@@ -198,6 +198,7 @@ pub enum ScreenContext {
SwitchTabPrev,
CloseTab,
GoToTab,
+ UpdateTabName,
}
impl From<&ScreenInstruction> for ScreenContext {
@@ -236,6 +237,7 @@ impl From<&ScreenInstruction> for ScreenContext {
ScreenInstruction::SwitchTabPrev => ScreenContext::SwitchTabPrev,
ScreenInstruction::CloseTab => ScreenContext::CloseTab,
ScreenInstruction::GoToTab(_) => ScreenContext::GoToTab,
+ ScreenInstruction::UpdateTabName(_) => ScreenContext::UpdateTabName,
}
}
}
diff --git a/src/common/input/actions.rs b/src/common/input/actions.rs
index fe5e2dad..88a7036f 100644
--- a/src/common/input/actions.rs
+++ b/src/common/input/actions.rs
@@ -48,4 +48,6 @@ pub enum Action {
/// Close the current tab.
CloseTab,
GoToTab(u32),
+ TabNameInput(Vec<u8>),
+ SaveTabName,
}
diff --git a/src/common/input/handler.rs b/src/common/input/handler.rs
index 5c4f1971..57bb46fb 100644
--- a/src/common/input/handler.rs
+++ b/src/common/input/handler.rs
@@ -7,7 +7,7 @@ use crate::errors::ContextType;
use crate::os_input_output::OsApi;
use crate::pty_bus::PtyInstruction;
use crate::screen::ScreenInstruction;
-use crate::wasm_vm::PluginInstruction;
+use crate::wasm_vm::{EventType, PluginInputType, PluginInstruction};
use crate::CommandIsExecuting;
use serde::{Deserialize, Serialize};
@@ -232,6 +232,28 @@ impl InputHandler {
.send(ScreenInstruction::GoToTab(i))
.unwrap();
}
+ Action::TabNameInput(c) => {
+ self.send_plugin_instructions
+ .send(PluginInstruction::Input(
+ PluginInputType::Event(EventType::Tab),
+ c.clone(),
+ ))
+ .unwrap();
+ self.send_screen_instructions
+ .send(ScreenInstruction::UpdateTabName(c))
+ .unwrap();
+ }
+ Action::SaveTabName => {
+ self.send_plugin_instructions
+ .send(PluginInstruction::Input(
+ PluginInputType::Event(EventType::Tab),
+ vec![b'\n'],
+ ))
+ .unwrap();
+ self.send_screen_instructions
+ .send(ScreenInstruction::UpdateTabName(vec![b'\n']))
+ .unwrap();
+ }
Action::NoOp => {}
}
@@ -250,13 +272,12 @@ impl InputHandler {
/// Describes the different input modes, which change the way that keystrokes will be interpreted.
#[derive(Debug, PartialEq, Eq, Hash, Copy, Clone, EnumIter, Serialize, Deserialize)]
pub enum InputMode {
- /// In `Normal` mode, input is always written to the terminal, except for one special input that
- /// triggers the switch to [`InputMode::Command`] mode.
+ /// In `Normal` mode, input is always written to the terminal, except for the shortcuts leading
+ /// to other modes
Normal,
- /// In `Command` mode, input is bound to actions (more precisely, sequences of actions).
- /// `Command` mode gives access to the other modes non-`InputMode::Normal` modes.
- /// etc.
- Command,
+ /// In `Locked` mode, input is always written to the terminal and all shortcuts are disabled
+ /// except the one leading back to normal mode
+ Locked,
/// `Resize` mode allows resizing the different existing panes.
Resize,
/// `Pane` mode allows creating and closing panes, as well as moving between them.
@@ -265,6 +286,7 @@ pub enum InputMode {
Tab,
/// `Scroll` mode allows scrolling up and down within a pane.
Scroll,
+ RenameTab,
}
/// Represents the contents of the help message that is printed in the status bar,
@@ -288,12 +310,7 @@ impl Default for InputMode {
pub fn get_help(mode: InputMode) -> Help {
let mut keybinds: Vec<(String, String)> = vec![];
match mode {
- InputMode::Normal | InputMode::Command => {
- keybinds.push(("p".to_string(), "PANE".to_string()));
- keybinds.push(("t".to_string(), "TAB".to_string()));
- keybinds.push(("r".to_string(), "RESIZE".to_string()));
- keybinds.push(("s".to_string(), "SCROLL".to_string()));
- }
+ InputMode::Normal | InputMode::Locked => {}
InputMode::Resize => {
keybinds.push(("←↓↑→".to_string(), "Resize".to_string()));
}
@@ -301,8 +318,8 @@ pub fn get_help(mode: InputMode) -> Help {
keybinds.push(("←↓↑→".to_string(), "Move focus".to_string()));
keybinds.push(("p".to_string(), "Next".to_string()));
keybinds.push(("n".to_string(), "New".to_string()));
- keybinds.push(("d".to_string(), "Split down".to_string()));
- keybinds.push(("r".to_string(), "Split right".to_string()));
+ keybinds.push(("d".to_string(), "Down split".to_string()));
+ keybinds.push(("r".to_string(), "Right split".to_string()));
keybinds.push(("x".to_string(), "Close".to_string()));
keybinds.push(("f".to_string(), "Fullscreen".to_string()));
}
@@ -310,13 +327,15 @@ pub fn get_help(mode: InputMode) -> Help {
keybinds.push(("←↓↑→".to_string(), "Move focus".to_string()));
keybinds.push(("n".to_string(), "New".to_string()));
keybinds.push(("x".to_string(), "Close".to_string()));
+ keybinds.push(("r".to_string(), "Rename".to_string()));
}
InputMode::Scroll => {
keybinds.push(("↓↑".to_string(), "Scroll".to_string()));
}
+ InputMode::RenameTab => {
+ keybinds.push(("Enter".to_string(), "when done".to_string()));
+ }
}
- keybinds.push(("ESC".to_string(), "BACK".to_string()));
- keybinds.push(("q".to_string(), "QUIT".to_string()));
Help { mode, keybinds }
}
diff --git a/src/common/input/keybinds.rs b/src/common/input/keybinds.rs
index e56488b4..4b676037 100644
--- a/src/common/input/keybinds.rs
+++ b/src/common/input/keybinds.rs
@@ -31,28 +31,52 @@ fn get_defaults_for_mode(mode: &InputMode) -> Result<ModeKeybinds, String> {
InputMode::Normal => {
defaults.insert(
Key::Ctrl('g'),
- vec![Action::SwitchToMode(InputMode::Command)],
+ vec![Action::SwitchToMode(InputMode::Locked)],
);
- }
- InputMode::Command => {
+ defaults.insert(Key::Ctrl('p'), vec![Action::SwitchToMode(InputMode::Pane)]);
defaults.insert(
- Key::Char('r'),
+ Key::Ctrl('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::Ctrl('t'), vec![Action::SwitchToMode(InputMode::Tab)]);
defaults.insert(
- Key::Char('s'),
+ Key::Ctrl('s'),
vec![Action::SwitchToMode(InputMode::Scroll)],
);
+ defaults.insert(Key::Ctrl('q'), vec![Action::Quit]);
+ }
+ InputMode::Locked => {
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::Ctrl('g'),
+ vec![Action::SwitchToMode(InputMode::Locked)],
+ );
+ defaults.insert(Key::Ctrl('p'), vec![Action::SwitchToMode(InputMode::Pane)]);
+ defaults.insert(
+ Key::Ctrl('r'),
+ vec![Action::SwitchToMode(InputMode::Normal)],
+ );
+ defaults.insert(Key::Ctrl('t'), vec![Action::SwitchToMode(InputMode::Tab)]);
+ defaults.insert(
+ Key::Ctrl('s'),
+ vec![Action::SwitchToMode(InputMode::Scroll)],
+ );
+ defaults.insert(Key::Ctrl('q'), vec![Action::Quit]);
+ defaults.insert(Key::Esc, vec![Action::SwitchToMode(InputMode::Normal)]);
+ defaults.insert(
+ Key::Char('\n'),
+ vec![Action::SwitchToMode(InputMode::Normal)],
+ );
+ defaults.insert(
+ Key::Char(' '),
+ vec![Action::SwitchToMode(InputMode::Normal)],
+ );
+
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)]);
@@ -62,20 +86,36 @@ fn get_defaults_for_mode(mode: &InputMode) -> Result<ModeKeybinds, String> {
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'), 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'), vec![Action::Quit]);
+ }
+ InputMode::Pane => {
defaults.insert(
Key::Ctrl('g'),
+ vec![Action::SwitchToMode(InputMode::Locked)],
+ );
+ defaults.insert(
+ Key::Ctrl('p'),
vec![Action::SwitchToMode(InputMode::Normal)],
);
- defaults.insert(Key::Esc, vec![Action::SwitchToMode(InputMode::Command)]);
- }
- InputMode::Pane => {
+ defaults.insert(
+ Key::Ctrl('r'),
+ vec![Action::SwitchToMode(InputMode::Resize)],
+ );
+ defaults.insert(Key::Ctrl('t'), vec![Action::SwitchToMode(InputMode::Tab)]);
+ defaults.insert(
+ Key::Ctrl('s'),
+ vec![Action::SwitchToMode(InputMode::Scroll)],
+ );
+ defaults.insert(Key::Ctrl('q'), vec![Action::Quit]);
+ defaults.insert(Key::Esc, vec![Action::SwitchToMode(InputMode::Normal)]);
+ defaults.insert(
+ Key::Char('\n'),
+ vec![Action::SwitchToMode(InputMode::Normal)],
+ );
+ defaults.insert(
+ Key::Char(' '),
+ vec![Action::SwitchToMode(InputMode::Normal)],
+ );
+
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)]);
@@ -86,11 +126,6 @@ fn get_defaults_for_mode(mode: &InputMode) -> Result<ModeKeybinds, String> {
defaults.insert(Key::Up, vec![Action::MoveFocus(Direction::Up)]);
defaults.insert(Key::Right, vec![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'), 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))]);
@@ -99,17 +134,37 @@ fn get_defaults_for_mode(mode: &InputMode) -> Result<ModeKeybinds, String> {
vec![Action::NewPane(Some(Direction::Right))],
);
defaults.insert(Key::Char('x'), vec![Action::CloseFocus]);
-
defaults.insert(Key::Char('f'), vec![Action::ToggleFocusFullscreen]);
-
- defaults.insert(Key::Char('q'), vec![Action::Quit]);
+ }
+ InputMode::Tab => {
defaults.insert(
Key::Ctrl('g'),
+ vec![Action::SwitchToMode(InputMode::Locked)],
+ );
+ defaults.insert(Key::Ctrl('p'), vec![Action::SwitchToMode(InputMode::Pane)]);
+ defaults.insert(
+ Key::Ctrl('r'),
+ vec![Action::SwitchToMode(InputMode::Resize)],
+ );
+ defaults.insert(
+ Key::Ctrl('t'),
vec![Action::SwitchToMode(InputMode::Normal)],
);
- defaults.insert(Key::Esc, vec![Action::SwitchToMode(InputMode::Command)]);
- }
- InputMode::Tab => {
+ defaults.insert(
+ Key::Ctrl('s'),
+ vec![Action::SwitchToMode(InputMode::Scroll)],
+ );
+ defaults.insert(Key::Ctrl('q'), vec![Action::Quit]);
+ defaults.insert(Key::Esc, vec![Action::SwitchToMode(InputMode::Normal)]);
+ defaults.insert(
+ Key::Char('\n'),
+ vec![Action::SwitchToMode(InputMode::Normal)],
+ );
+ defaults.insert(
+ Key::Char(' '),
+ vec![Action::SwitchToMode(InputMode::Normal)],
+ );
+
defaults.insert(Key::Char('h'), vec![Action::GoToPreviousTab]);
defaults.insert(Key::Char('j'), vec![Action::GoToNextTab]);
defaults.insert(Key::Char('k'), vec![Action::GoToPreviousTab]);
@@ -120,14 +175,16 @@ fn get_defaults_for_mode(mode: &InputMode) -> Result<ModeKeybinds, String> {
defaults.insert(Key::Up, vec![Action::GoToPreviousTab]);
defaults.insert(Key::Right, vec![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'), vec![Action::NewTab]);
defaults.insert(Key::Char('x'), vec![Action::CloseTab]);
+ defaults.insert(
+ Key::Char('r'),
+ vec![
+ Action::SwitchToMode(InputMode::RenameTab),
+ Action::TabNameInput(vec![0]),
+ ],
+ );
defaults.insert(Key::Char('q'), vec![Action::Quit]);
defaults.insert(
Key::Ctrl('g'),
@@ -136,24 +193,55 @@ fn get_defaults_for_mode(mode: &InputMode) -> Result<ModeKeybinds, String> {
for i in '1'..='9' {
defaults.insert(Key::Char(i), vec![Action::GoToTab(i.to_digit(10).unwrap())]);
}
- defaults.insert(Key::Esc, vec![Action::SwitchToMode(InputMode::Command)]);
}
InputMode::Scroll => {
+ defaults.insert(
+ Key::Ctrl('g'),
+ vec![Action::SwitchToMode(InputMode::Locked)],
+ );
+ defaults.insert(Key::Ctrl('p'), vec![Action::SwitchToMode(InputMode::Pane)]);
+ defaults.insert(
+ Key::Ctrl('r'),
+ vec![Action::SwitchToMode(InputMode::Resize)],
+ );
+ defaults.insert(Key::Ctrl('t'), vec![Action::SwitchToMode(InputMode::Tab)]);
+ defaults.insert(
+ Key::Ctrl('s'),
+ vec![Action::SwitchToMode(InputMode::Normal)],
+ );
+ defaults.insert(Key::Ctrl('q'), vec![Action::Quit]);
+ defaults.insert(Key::Esc, vec![Action::SwitchToMode(InputMode::Normal)]);
+ defaults.insert(
+ Key::Char('\n'),
+ vec![Action::SwitchToMode(InputMode::Normal)],
+ );
+ defaults.insert(
+ Key::Char(' '),
+ vec![Action::SwitchToMode(InputMode::Normal)],
+ );
+
defaults.insert(Key::Char('j'), vec![Action::ScrollDown]);
defaults.insert(Key::Char('k'), vec![Action::ScrollUp]);
defaults.insert(Key::Down, vec![Action::ScrollDown]);
defaults.insert(Key::Up, vec![Action::ScrollUp]);
-
- defaults.insert(Key::Ctrl('n'), vec![Action::ScrollDown]);
- defaults.insert(Key::Ctrl('p'), vec![Action::ScrollUp]);
-
- defaults.insert(Key::Char('q'), vec![Action::Quit]);
+ }
+ InputMode::RenameTab => {
+ defaults.insert(
+ Key::Char('\n'),
+ vec![Action::SaveTabName, Action::SwitchToMode(InputMode::Tab)],
+ );
defaults.insert(
Key::Ctrl('g'),
vec![Action::SwitchToMode(InputMode::Normal)],
);
- defaults.insert(Key::Esc, vec![Action::SwitchToMode(InputMode::Command)]);
+ defaults.insert(
+ Key::Esc,
+ vec![
+ Action::TabNameInput(vec![0x1b]),
+ Action::SwitchToMode(InputMode::Tab),
+ ],
+ );
}
}
@@ -177,7 +265,8 @@ pub fn key_to_actions(
.unwrap_or_else(|| vec![action])
};
match *mode {
- InputMode::Normal => mode_keybind_or_action(Action::Write(input)),
+ InputMode::Normal | InputMode::Locked => mode_keybind_or_action(Action::Write(input)),
+ InputMode::RenameTab => mode_keybind_or_action(Action::TabNameInput(input)),
_ => mode_keybind_or_action(Action::NoOp),
}
}
diff --git a/src/common/mod.rs b/src/common/mod.rs
index f78303ea..7b19bcef 100644
--- a/src/common/mod.rs
+++ b/src/common/mod.rs
@@ -34,7 +34,9 @@ use os_input_output::OsApi;
use pty_bus::{PtyBus, PtyInstruction};
use screen::{Screen, ScreenInstruction};
use utils::consts::{ZELLIJ_IPC_PIPE, ZELLIJ_ROOT_PLUGIN_DIR};
-use wasm_vm::{wasi_stdout, wasi_write_string, zellij_imports, PluginInstruction};
+use wasm_vm::{
+ wasi_stdout, wasi_write_string, zellij_imports, EventType, PluginInputType, PluginInstruction,
+};
#[derive(Serialize, Deserialize, Debug)]
pub enum ApiCommand {
@@ -419,6 +421,9 @@ pub fn start(mut os_input: Box<dyn OsApi>, opts: CliArgs) {
ScreenInstruction::GoToTab(tab_index) => {
screen.go_to_tab(tab_index as usize)
}
+ ScreenInstruction::UpdateTabName(c) => {
+ screen.update_active_tab_name(c);
+ }
ScreenInstruction::Quit => {
break;
}
@@ -438,6 +443,11 @@ pub fn start(mut os_input: Box<dyn OsApi>, opts: CliArgs) {
let store = Store::default();
let mut plugin_id = 0;
let mut plugin_map = HashMap::new();
+ let handler_map: HashMap<EventType, String> =
+ [(EventType::Tab, "handle_tab_rename_keypress".to_string())]
+ .iter()
+ .cloned()
+ .collect();
move || loop {
let (event, mut err_ctx) = receive_plugin_instructions
@@ -448,7 +458,7 @@ pub fn start(mut os_input: Box<dyn OsApi>, opts: CliArgs) {
send_pty_instructions.update(err_ctx);
send_app_instructions.update(err_ctx);
match event {
- PluginInstruction::Load(pid_tx, path) => {
+ PluginInstruction::Load(pid_tx, path, events) => {
let project_dirs =
ProjectDirs::from("org", "Zellij Contributors", "Zellij").unwrap();
let plugin_dir = project_dirs.data_dir().join("plugins/");
@@ -490,6 +500,7 @@ pub fn start(mut os_input: Box<dyn OsApi>, opts: CliArgs) {
send_screen_instructions: send_screen_instructions.clone(),
send_app_instructions: send_app_instructions.clone(),
wasi_env,
+ events,
};
let zellij = zellij_imports(&store, &plugin_env);
@@ -514,32 +525,58 @@ pub fn start(mut os_input: Box<dyn OsApi>, opts: CliArgs) {
buf_tx.send(wasi_stdout(&plugin_env.wasi_env)).unwrap();
}
- PluginInstruction::UpdateTabs(active_tab_index, num_tabs) => {
- for (instance, _) in plugin_map.values() {
+ PluginInstruction::UpdateTabs(mut tabs) => {
+ for (instance, plugin_env) in plugin_map.values() {
+ if !plugin_env.events.contains(&EventType::Tab) {
+ continue;
+ }
let handler = instance.exports.get_function("update_tabs").unwrap();
- handler
- .call(&[
- Value::I32(active_tab_index as i32),
- Value::I32(num_tabs as i32),
- ])
- .unwrap();
+ tabs.sort_by(|a, b| a.position.cmp(&b.position));
+ wasi_write_string(
+ &plugin_env.wasi_env,
+ &serde_json::to_string(&tabs).unwrap(),
+ );
+ handler.call(&[]).unwrap();
}
}
// FIXME: Deduplicate this with the callback below!
- PluginInstruction::Input(pid, input_bytes) => {
- let (instance, plugin_env) = plugin_map.get(&pid).unwrap();
-
- let handle_key = instance.exports.get_function("handle_key").unwrap();
- for key in input_bytes.keys() {
- if let Ok(key) = key {
- wasi_write_string(
- &plugin_env.wasi_env,
- &serde_json::to_string(&key).unwrap(),
- );
- handle_key.call(&[]).unwrap();
+ PluginInstruction::Input(input_type, input_bytes) => {
+ match input_type {
+ PluginInputType::Normal(pid) => {
+ let (instance, plugin_env) = plugin_map.get(&pid).unwrap();
+ let handle_key =
+ instance.exports.get_function("handle_key").unwrap();
+ for key in input_bytes.keys() {
+ if let Ok(key) = key {
+ wasi_write_string(
+ &plugin_env.wasi_env,
+ &serde_json::to_string(&key).unwrap(),
+ );
+ handle_key.call(&[]).unwrap();
+ }
+ }
+ }
+ PluginInputType::Event(event) => {
+ for (instance, plugin_env) in plugin_map.values() {
+ if !plugin_env.events.contains(&event) {
+ continue;
+ }
+ let handle_key = instance
+ .exports
+ .get_function(handler_map.get(&event).unwrap())
+ .unwrap();
+ for key in input_bytes.keys() {
+ if let Ok(key) = key {
+ wasi_write_string(
+ &plugin_env.wasi_env,
+ &serde_json::to_string(&key).unwrap(),
+ );
+ handle_key.call(&[]).unwrap();
+ }
+ }
+ }
}
}
-
drop(send_screen_instructions.send(ScreenInstruction::Render));
}
PluginInstruction::GlobalInput(input_bytes) => {
diff --git a/src/common/screen.rs b/src/common/screen.rs
index 7747b43b..57bb0e0f 100644
--- a/src/common/screen.rs
+++ b/src/common/screen.rs
@@ -2,13 +2,14 @@
use std::collections::BTreeMap;
use std::os::unix::io::RawFd;
+use std::str;
use std::sync::mpsc::Receiver;
use super::{AppInstruction, SenderWithContext};
use crate::os_input_output::OsApi;
use crate::panes::PositionAndSize;
use crate::pty_bus::{PtyInstruction, VteEvent};
-use crate::tab::Tab;
+use crate::tab::{Tab, TabData};
use crate::{errors::ErrorContext, wasm_vm::PluginInstruction};
use crate::{layout::Layout, panes::PaneId};
@@ -46,6 +47,7 @@ pub enum ScreenInstruction {
SwitchTabPrev,
CloseTab,
GoToTab(u32),
+ UpdateTabName(Vec<u8>),
}
/// A [`Screen`] holds multiple [`Tab`]s, each one holding multiple [`panes`](crate::client::panes).
@@ -69,6 +71,7 @@ pub struct Screen {
active_tab_index: Option<usize>,
/// The [`OsApi`] this [`Screen`] uses.
os_api: Box<dyn OsApi>,
+ tabname_buf: String,
}
impl Screen {
@@ -92,6 +95,7 @@ impl Screen {
active_tab_index: None,
tabs: BTreeMap::new(),
os_api,
+ tabname_buf: String::new(),
}
}
@@ -103,6 +107,7 @@ impl Screen {
let tab = Tab::new(
tab_index,
position,
+ String::new(),
&self.full_screen_ws,
self.os_api.clone(),
self.send_pty_instructions.clone(),
@@ -246,6 +251,7 @@ impl Screen {
let mut tab = Tab::new(
tab_index,
position,
+ String::new(),
&self.full_screen_ws,
self.os_api.clone(),
self.send_pty_instructions.clone(),
@@ -261,13 +267,40 @@ impl Screen {
}
fn update_tabs(&self) {
- if let Some(active_tab) = self.get_active_tab() {
- self.send_plugin_instructions
- .send(PluginInstruction::UpdateTabs(
- active_tab.position,
- self.tabs.len(),
- ))
- .unwrap();
+ let mut tab_data = vec![];
+ let active_tab_index = self.active_tab_index.unwrap();
+ for tab in self.tabs.values() {
+ tab_data.push(TabData {
+ position: tab.position,
+ name: tab.name.clone(),
+ active: active_tab_index == tab.index,
+ });
+ }
+ self.send_plugin_instructions
+ .send(PluginInstruction::UpdateTabs(tab_data))
+ .unwrap();
+ }
+
+ pub fn update_active_tab_name(&mut self, buf: Vec<u8>) {
+ let s = str::from_utf8(&buf).unwrap();
+ match s {
+ "\0" => {
+ self.tabname_buf = String::new();
+ }
+ "\n" => {
+ let new_name = self.tabname_buf.clone();
+ let active_tab = self.get_active_tab_mut().unwrap();
+ active_tab.name = new_name;
+ self.update_tabs();
+ self.render();
+ }
+ "\u{007F}" | "\u{0008}" => {
+ //delete and backspace keys
+ self.tabname_buf.pop();
+ }
+ c => {
+ self.tabname_buf.push_str(c);
+ }
}
}
}
diff --git a/src/common/wasm_vm.rs b/src/common/wasm_vm.rs
index 5d4b1e30..15b920ad 100644
--- a/src/common/wasm_vm.rs
+++ b/src/common/wasm_vm.rs
@@ -1,24 +1,36 @@
+use crate::tab::TabData;
+use serde::{Deserialize, Serialize};
use std::{
path::PathBuf,
sync::mpsc::{channel, Sender},
};
use wasmer::{imports, Function, ImportObject, Store, WasmerEnv};
use wasmer_wasi::WasiEnv;
-// use crate::utils::logging::debug_log_to_file;
use super::{
input::handler::get_help, pty_bus::PtyInstruction, screen::ScreenInstruction, AppInstruction,
PaneId, SenderWithContext,
};
+#[derive(Clone, Debug, PartialEq, Hash, Eq, Serialize, Deserialize)]
+pub enum EventType {
+ Tab,
+}
+
+#[derive(Clone, Debug)]
+pub enum PluginInputType {
+ Normal(u32),
+ Event(EventType),
+}
+
#[derive(Clone, Debug)]
pub enum PluginInstruction {
- Load(Sender<u32>, PathBuf),
+ Load(Sender<u32>, PathBuf, Vec<EventType>),
Draw(Sender<String>, u32, usize, usize), // String buffer, plugin id, rows, cols
- Input(u32, Vec<u8>), // plugin id, input bytes
+ Input(PluginInputType, Vec<u8>), // plugin id, input bytes
GlobalInput(Vec<u8>), // input bytes
Unload(u32),
- UpdateTabs(usize, usize), // num tabs, active tab
+ UpdateTabs(Vec<TabData>), // num tabs, active tab
Quit,
}
@@ -29,6 +41,7 @@ pub struct PluginEnv {
pub send_app_instructions: SenderWithContext<AppInstruction>,
pub send_pty_instructions: SenderWithContext<PtyInstruction>, // FIXME: This should be a big bundle of all of the channels
pub wasi_env: WasiEnv,
+ pub events: Vec<EventType>,
}
// Plugin API ---------------------------------------------------------------------------------------------------------
diff --git a/src/tests/fakes.rs b/src/tests/fakes.rs
index fa9c6f0e..c800de97 100644
--- a/src/tests/fakes.rs
+++ b/src/tests/fakes.rs
@@ -10,6 +10,8 @@ use std::time::{Duration, Instant};
use crate::os_input_output::OsApi;
use crate::tests::possible_tty_inputs::{get_possible_tty_inputs, Bytes};
+use crate::tests::utils::commands::SLEEP;
+
const MIN_TIME_BETWEEN_SNAPSHOTS: Duration = Duration::from_millis(50);
#[derive(Clone)]
@@ -189,11 +191,16 @@ impl OsApi for FakeInputOutput {
::std::thread::sleep(MIN_TIME_BETWEEN_SNAPSHOTS - last_snapshot_time.elapsed());
}
}
- self.stdin_commands
+ let command = self
+ .stdin_commands
.lock()
.unwrap()
.pop_front()
- .unwrap_or(vec![])
+ .unwrap_or(vec![]);
+ if command == SLEEP {
+ std::thread::sleep(std::time::Duration::from_millis(200));
+ }
+ command
}
fn get_stdout_writer(&self) -> Box<dyn Write> {
Box::new(self.stdout_writer.clone())
diff --git a/src/tests/integration/basic.rs b/src/tests/integration/basic.rs
index 75108955..377e25b2 100644
--- a/src/tests/integration/basic.rs
+++ b/src/tests/integration/basic.rs
@@ -3,12 +3,11 @@ use ::insta::assert_snapshot;
use crate::tests::fakes::FakeInputOutput;
use crate::tests::utils::commands::{
- COMMAND_TOGGLE, ESC, PANE_MODE, QUIT, SCROLL_DOWN_IN_SCROLL_MODE, SCROLL_MODE,
- SCROLL_UP_IN_SCROLL_MODE, SPAWN_TERMINAL_IN_PANE_MODE, SPLIT_DOWN_IN_PANE_MODE,
- SPLIT_RIGHT_IN_PANE_MODE, TOGGLE_ACTIVE_TERMINAL_FULLSCREEN_IN_PANE_MODE,
+ PANE_MODE, QUIT, SCROLL_DOWN_IN_SCROLL_MODE, SCROLL_MODE, SCROLL_UP_IN_SCROLL_MODE,
+ SPAWN_TERMINAL_IN_PANE_MODE, SPLIT_DOWN_IN_PANE_MODE, SPLIT_RIGHT_IN_PANE_MODE,
+ TOGGLE_ACTIVE_TERMINAL_FULLSCREEN_IN_PANE_MODE,
};
use crate::tests::utils::{get_next_to_last_snapshot, get_output_frame_snapshots};
-use crate::utils::logging::debug_log_to_file;
use crate::{start, CliArgs};
fn get_fake_os_input(fake_win_size: &PositionAndSize) -> FakeInputOutput {
@@ -24,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, &QUIT]);
+ fake_input_output.add_terminal_input(&[&QUIT]);
start(Box::new(fake_input_output.clone()), CliArgs::default());
let output_frames = fake_input_output
.stdout_writer
@@ -46,12 +45,7 @@ pub fn split_terminals_vertically() {
y: 0,
};
let mut fake_input_output = get_fake_os_input(&fake_win_size);
- fake_input_output.add_terminal_input(&[
- &COMMAND_TOGGLE,
- &PANE_MODE,
- &SPLIT_RIGHT_IN_PANE_MODE,
- &QUIT,
- ]);
+ fake_input_output.add_terminal_input(&[&PANE_MODE, &SPLIT_RIGHT_IN_PANE_MODE, &QUIT]);
start(Box::new(fake_input_output.clone()), CliArgs::default());
let output_frames = fake_input_output
.stdout_writer
@@ -73,12 +67,7 @@ pub fn split_terminals_horizontally() {
y: 0,
};
let mut fake_input_output = get_fake_os_input(&fake_win_size);
- fake_input_output.add_terminal_input(&[
- &COMMAND_TOGGLE,
- &PANE_MODE,
- &SPLIT_DOWN_IN_PANE_MODE,
- &QUIT,
- ]);
+ fake_input_output.add_terminal_input(&[&PANE_MODE, &SPLIT_DOWN_IN_PANE_MODE, &QUIT]);
start(Box::new(fake_input_output.clone()), CliArgs::default());
let output_frames = fake_input_output
.stdout_writer
@@ -102,7 +91,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,
&PANE_MODE,
&SPAWN_TERMINAL_IN_PANE_MODE,
&SPAWN_TERMINAL_IN_PANE_MODE,
@@ -130,12 +118,7 @@ pub fn cannot_split_terminals_vertically_when_active_terminal_is_too_small() {
y: 0,
};
let mut fake_input_output = get_fake_os_input(&fake_win_size);
- fake_input_output.add_terminal_input(&[
- &COMMAND_TOGGLE,
- &PANE_MODE,
- &SPLIT_RIGHT_IN_PANE_MODE,
- &QUIT,
- ]);
+ fake_input_output.add_terminal_input(&[&PANE_MODE, &SPLIT_RIGHT_IN_PANE_MODE, &QUIT]);
start(Box::new(fake_input_output.clone()), CliArgs::default());
let output_frames = fake_input_output
.stdout_writer
@@ -157,12 +140,7 @@ pub fn cannot_split_terminals_horizontally_when_active_terminal_is_too_small() {
y: 0,
};
let mut fake_input_output = get_fake_os_input(&fake_win_size);
- fake_input_output.add_terminal_input(&[
- &COMMAND_TOGGLE,
- &PANE_MODE,
- &SPLIT_DOWN_IN_PANE_MODE,
- &QUIT,
- ]);
+ fake_input_output.add_terminal_input(&[&PANE_MODE, &SPLIT_DOWN_IN_PANE_MODE, &QUIT]);
start(Box::new(fake_input_output.clone()), CliArgs::default());
let output_frames = fake_input_output
.stdout_writer
@@ -184,12 +162,7 @@ pub fn cannot_split_largest_terminal_when_there_is_no_room() {
y: 0,
};
let mut fake_input_output = get_fake_os_input(&fake_win_size);
- fake_input_output.add_terminal_input(&[
- &COMMAND_TOGGLE,
- &PANE_MODE,
- &SPAWN_TERMINAL_IN_PANE_MODE,
- &QUIT,
- ]);
+ fake_input_output.add_terminal_input(&[&PANE_MODE, &SPAWN_TERMINAL_IN_PANE_MODE, &QUIT]);
start(Box::new(fake_input_output.clone()), CliArgs::default());
let output_frames = fake_input_output
.stdout_writer
@@ -212,11 +185,9 @@ 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,
&PANE_MODE,
&SPLIT_DOWN_IN_PANE_MODE,
&SPLIT_RIGHT_IN_PANE_MODE,
- &ESC,
&SCROLL_MODE,
&SCROLL_UP_IN_SCROLL_MODE,
&SCROLL_UP_IN_SCROLL_MODE,
@@ -244,11 +215,9 @@ 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,
&PANE_MODE,
&SPLIT_DOWN_IN_PANE_MODE,
&SPLIT_RIGHT_IN_PANE_MODE,
- &ESC,
&SCROLL_MODE,
&SCROLL_UP_IN_SCROLL_MODE,
&SCROLL_UP_IN_SCROLL_MODE,
@@ -280,7 +249,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,
&PANE_MODE,
&SPAWN_TERMINAL_IN_PANE_MODE,
&SPAWN_TERMINAL_IN_PANE_MODE,
@@ -312,7 +280,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,
&PANE_MODE,
&SPAWN_TERMINAL_IN_PANE_MODE,
&SPAWN_TERMINAL_IN_PANE_MODE,
diff --git a/src/tests/integration/close_pane.rs b/src/tests/integration/close_pane.rs
index 82bcb9a4..0a7aea48 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,
&PANE_MODE,
&SPLIT_DOWN_IN_PANE_MODE,
&CLOSE_PANE_IN_PANE_MODE,
@@ -70,7 +69,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,
&PANE_MODE,
&SPLIT_DOWN_IN_PANE_MODE,
&MOVE_FOCUS_IN_PANE_MODE,
@@ -106,7 +104,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,
&PANE_MODE,
&SPLIT_RIGHT_IN_PANE_MODE,
&CLOSE_PANE_IN_PANE_MODE,
@@ -141,7 +138,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,
&PANE_MODE,
&SPLIT_RIGHT_IN_PANE_MODE,
&MOVE_FOCUS_IN_PANE_MODE,
@@ -179,7 +175,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,
&PANE_MODE,
&SPLIT_DOWN_IN_PANE_MODE,
&MOVE_FOCUS_IN_PANE_MODE,
@@ -220,7 +215,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,
&PANE_MODE,
&SPLIT_DOWN_IN_PANE_MODE,
&SPLIT_RIGHT_IN_PANE_MODE,
@@ -259,7 +253,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,
&PANE_MODE,
&SPLIT_RIGHT_IN_PANE_MODE,
&MOVE_FOCUS_IN_PANE_MODE,
@@ -300,7 +293,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,
&PANE_MODE,
&SPLIT_RIGHT_IN_PANE_MODE,
&SPLIT_DOWN_IN_PANE_MODE,
@@ -339,7 +331,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,
&PANE_MODE,
&SPLIT_DOWN_IN_PANE_MODE,
&SPLIT_RIGHT_IN_PANE_MODE,
@@ -400,7 +391,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,
&PANE_MODE,
&SPLIT_DOWN_IN_PANE_MODE,
&SPLIT_RIGHT_IN_PANE_MODE,
@@ -408,16 +398,12 @@ pub fn close_pane_with_multiple_panes_below_it_away_from_screen_edges() {
&MOVE_FOCUS_IN_PANE_MODE,
&SPLIT_RIGHT_IN_PANE_MODE,
&SPLIT_RIGHT_IN_PANE_MODE,
- &ESC,
&RESIZE_MODE,
&RESIZE_DOWN_IN_RESIZE_MODE,
- &ESC,
&PANE_MODE,
&MOVE_FOCUS_IN_PANE_MODE,
- &ESC,
&RESIZE_MODE,
&RESIZE_DOWN_IN_RESIZE_MODE,
- &ESC,
&PANE_MODE,
&MOVE_FOCUS_IN_PANE_MODE,
&MOVE_FOCUS_IN_PANE_MODE,
@@ -463,7 +449,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,
&PANE_MODE,
&SPLIT_RIGHT_IN_PANE_MODE,
&SPLIT_DOWN_IN_PANE_MODE,
@@ -471,16 +456,12 @@ pub fn close_pane_with_multiple_panes_to_the_left_away_from_screen_edges() {
&MOVE_FOCUS_IN_PANE_MODE,
&SPLIT_DOWN_IN_PANE_MODE,
&SPLIT_DOWN_IN_PANE_MODE,
- &ESC,
&RESIZE_MODE,
&RESIZE_LEFT_IN_RESIZE_MODE,
- &ESC,
&PANE_MODE,
&MOVE_FOCUS_IN_PANE_MODE,
- &ESC,
&RESIZE_MODE,
&RESIZE_LEFT_IN_RESIZE_MODE,
- &ESC,
&PANE_MODE,
&MOVE_FOCUS_IN_PANE_MODE,
&MOVE_FOCUS_IN_PANE_MODE,
@@ -526,7 +507,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,
&PANE_MODE,
&SPLIT_RIGHT_IN_PANE_MODE,
&SPLIT_DOWN_IN_PANE_MODE,
@@ -534,16 +514,12 @@ pub fn close_pane_with_multiple_panes_to_the_right_away_from_screen_edges() {
&MOVE_FOCUS_IN_PANE_MODE,
&SPLIT_DOWN_IN_PANE_MODE,
&SPLIT_DOWN_IN_PANE_MODE,
- &ESC,
&RESIZE_MODE,
&RESIZE_LEFT_IN_RESIZE_MODE,
- &ESC,
&PANE_MODE,
&MOVE_FOCUS_IN_PANE_MODE,
- &ESC,
&RESIZE_MODE,
&RESIZE_LEFT_IN_RESIZE_MODE,
- &ESC,
&PANE_MODE,
&MOVE_FOCUS_IN_PANE_MODE,
&MOVE_FOCUS_IN_PANE_MODE,
@@ -579,7 +555,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,
&PANE_MODE,
&SPLIT_RIGHT_IN_PANE_MODE,
&SPLIT_DOWN_IN_PANE_MODE,
diff --git a/src/tests/integration/compatibility.rs b/src/tests/integration/compatibility.rs
index e0233022..229c259f 100644
--- a/src/tests/integration/compatibility.rs
+++ b/src/tests/integration/compatibility.rs
@@ -7,7 +7,7 @@ use crate::tests::possible_tty_inputs::Bytes;
use crate::tests::utils::{get_next_to_last_snapshot, get_output_frame_snapshots};
use crate::{start, CliArgs};
-use crate::tests::utils::commands::{COMMAND_TOGGLE, QUIT};
+use crate::tests::utils::commands::QUIT;
/*
* These tests are general compatibility tests for non-trivial scenarios running in the terminal.
@@ -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, &QUIT]);
+ fake_input_output.add_terminal_input(&[&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, &QUIT]);
+ fake_input_output.add_terminal_input(&[&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, &QUIT]);
+ fake_input_output.add_terminal_input(&[&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, &QUIT]); // quit (ctrl-q)
+ fake_input_output.add_terminal_input(&[&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, &QUIT]);
+ fake_input_output.add_terminal_input(&[&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, &QUIT]);
+ fake_input_output.add_terminal_input(&[&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, &QUIT]);
+ fake_input_output.add_terminal_input(&[&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, &QUIT]);
+ fake_input_output.add_terminal_input(&[&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, &QUIT]);
+ fake_input_output.add_terminal_input(&[&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, &QUIT]);
+ fake_input_output.add_terminal_input(&[&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, &QUIT]);
+ fake_input_output.add_terminal_input(&[&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, &QUIT]);
+ fake_input_output.add_terminal_input(&[&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, &QUIT]);
+ fake_input_output.add_terminal_input(&[&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, &QUIT]);
+ fake_input_output.add_terminal_input(&[&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, &QUIT]);
+ fake_input_output.add_terminal_input(&[&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, &QUIT]);
+ fake_input_output.add_terminal_input(&[&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, &QUIT]);
+ fake_input_output.add_terminal_input(&[&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, &QUIT]);
+ fake_input_output.add_terminal_input(&[&QUIT]);
start(Box::new(fake_input_output.clone()), CliArgs::default());
let output_frames = fake_input_output
.stdout_writer
@@ -495,7 +495,7 @@ pub fn top_and_quit() {
};
let fixture_name = "top_and_quit";
let mut fake_input_output = get_fake_os_input(&fake_win_size, fixture_name);
- fake_input_output.add_terminal_input(&[&COMMAND_TOGGLE, &QUIT]);
+ fake_input_output.add_terminal_input(&[&QUIT]);
start(Box::new(fake_input_output.clone()), CliArgs::default());
let output_frames = fake_input_output
.stdout_writer
@@ -524,7 +524,7 @@ pub fn exa_plus_omf_theme() {
};
let fixture_name = "exa_plus_omf_theme";
let mut fake_input_output = get_fake_os_input(&fake_win_size, fixture_name);
- fake_input_output.add_terminal_input(&[&COMMAND_TOGGLE, &QUIT]);
+ fake_input_output.add_terminal_input(&[&QUIT]);
start(Box::new(fake_input_output.clone()), CliArgs::default());
let output_frames = fake_input_output
.stdout_writer
diff --git a/src/tests/integration/expansion_boundary.rs b/src/tests/integration/expansion_boundary.rs
index 1c3776e9..c68c1d5a 100644
--- a/src/tests/integration/expansion_boundary.rs
+++ b/src/tests/integration/expansion_boundary.rs
@@ -4,8 +4,8 @@ use std::path::PathBuf;
use crate::panes::PositionAndSize;
use crate::tests::fakes::FakeInputOutput;
use crate::tests::utils::commands::{
- COMMAND_TOGGLE, ESC, PANE_MODE, QUIT, RESIZE_DOWN_IN_RESIZE_MODE, RESIZE_MODE,
- SPAWN_TERMINAL_IN_PANE_MODE, TOGGLE_ACTIVE_TERMINAL_FULLSCREEN_IN_PANE_MODE,
+ PANE_MODE, QUIT, RESIZE_DOWN_IN_RESIZE_MODE, RESIZE_MODE, SLEEP, SPAWN_TERMINAL_IN_PANE_MODE,
+ TOGGLE_ACTIVE_TERMINAL_FULLSCREEN_IN_PANE_MODE,
};
use crate::tests::utils::{get_next_to_last_snapshot, get_output_frame_snapshots};
use crate::{start, CliArgs};
@@ -24,9 +24,9 @@ pub fn new_panes_are_open_inside_expansion_border() {
};
let mut fake_input_output = get_fake_os_input(&fake_win_size);
fake_input_output.add_terminal_input(&[
- &COMMAND_TOGGLE,
&PANE_MODE,
&SPAWN_TERMINAL_IN_PANE_MODE,
+ &SLEEP,
&QUIT,
]);
let mut opts = CliArgs::default();
@@ -56,12 +56,11 @@ pub fn resize_pane_inside_expansion_border() {
};
let mut fake_input_output = get_fake_os_input(&fake_win_size);
fake_input_output.add_terminal_input(&[
- &COMMAND_TOGGLE,
&PANE_MODE,
&SPAWN_TERMINAL_IN_PANE_MODE,
- &ESC,
&RESIZE_MODE,
&RESIZE_DOWN_IN_RESIZE_MODE,
+ &SLEEP,
&QUIT,
]);
let mut opts = CliArgs::default();
@@ -91,10 +90,10 @@ pub fn toggling_fullcsreen_in_expansion_border_expands_only_until_border() {
};
let mut fake_input_output = get_fake_os_input(&fake_win_size);
fake_input_output.add_terminal_input(&[
- &COMMAND_TOGGLE,
&PANE_MODE,
&SPAWN_TERMINAL_IN_PANE_MODE,
&TOGGLE_ACTIVE_TERMINAL_FULLSCREEN_IN_PANE_MODE,
+ &SLEEP,
&QUIT,
]);
let mut opts = CliArgs::default();
diff --git a/src/tests/integration/layouts.rs b/src/tests/integration/layouts.rs
index 9728e4ab..3fb62715 100644
--- a/src/tests/integration/layouts.rs
+++ b/src/tests/integration/layouts.rs
@@ -3,7 +3,7 @@ use std::path::PathBuf;
use crate::panes::PositionAndSize;
use crate::tests::fakes::FakeInputOutput;
-use crate::tests::utils::commands::{COMMAND_TOGGLE, QUIT};
+use crate::tests::utils::commands::QUIT;
use crate::tests::utils::get_output_frame_snapshots;
use crate::{start, CliArgs};
@@ -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, &QUIT]);
+ fake_input_output.add_terminal_input(&[&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 e241714a..430113c0 100644
--- a/src/tests/integration/move_focus_down.rs
+++ b/src/tests/integration/move_focus_down.rs
@@ -6,7 +6,7 @@ use crate::tests::utils::{get_next_to_last_snapshot, get_output_frame_snapshots}
use crate::{start, CliArgs};
use crate::tests::utils::commands::{
- COMMAND_TOGGLE, MOVE_FOCUS_DOWN_IN_PANE_MODE, MOVE_FOCUS_UP_IN_PANE_MODE, PANE_MODE, QUIT,
+ MOVE_FOCUS_DOWN_IN_PANE_MODE, MOVE_FOCUS_UP_IN_PANE_MODE, PANE_MODE, QUIT,
SPLIT_DOWN_IN_PANE_MODE, SPLIT_RIGHT_IN_PANE_MODE,
};
@@ -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,
&PANE_MODE,
&SPLIT_DOWN_IN_PANE_MODE,
&MOVE_FOCUS_UP_IN_PANE_MODE,
@@ -54,7 +53,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,
&PANE_MODE,
&SPLIT_DOWN_IN_PANE_MODE,
&SPLIT_RIGHT_IN_PANE_MODE,
diff --git a/src/tests/integration/move_focus_left.rs b/src/tests/integration/move_focus_left.rs
index 153188d3..f5d4e025 100644
--- a/src/tests/integration/move_focus_left.rs
+++ b/src/tests/integration/move_focus_left.rs
@@ -6,7 +6,7 @@ use crate::tests::utils::{get_next_to_last_snapshot, get_output_frame_snapshots}
use crate::{start, CliArgs};
use crate::tests::utils::commands::{
- COMMAND_TOGGLE, MOVE_FOCUS_LEFT_IN_PANE_MODE, MOVE_FOCUS_RIGHT_IN_PANE_MODE, PANE_MODE, QUIT,
+ MOVE_FOCUS_LEFT_IN_PANE_MODE, MOVE_FOCUS_RIGHT_IN_PANE_MODE, PANE_MODE, QUIT,
SPLIT_DOWN_IN_PANE_MODE, SPLIT_RIGHT_IN_PANE_MODE,
};
@@ -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,
&PANE_MODE,
&SPLIT_RIGHT_IN_PANE_MODE,
&MOVE_FOCUS_LEFT_IN_PANE_MODE,
@@ -53,7 +52,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,
&PANE_MODE,
&SPLIT_RIGHT_IN_PANE_MODE,
&MOVE_FOCUS_LEFT_IN_PANE_MODE,
diff --git a/src/tests/integration/move_focus_right.rs b/src/tests/integration/move_focus_right.rs
index d9b243fb..24147d3e 100644
--- a/src/tests/integration/move_focus_right.rs
+++ b/src/tests/integration/move_focus_right.rs
@@ -6,7 +6,7 @@ use crate::tests::utils::{get_next_to_last_snapshot, get_output_frame_snapshots}
use crate::{start, CliArgs};
use crate::tests::utils::commands::{
- COMMAND_TOGGLE, MOVE_FOCUS_LEFT_IN_PANE_MODE, MOVE_FOCUS_RIGHT_IN_PANE_MODE, PANE_MODE, QUIT,
+ MOVE_FOCUS_LEFT_IN_PANE_MODE, MOVE_FOCUS_RIGHT_IN_PANE_MODE, PANE_MODE, QUIT,
SPLIT_DOWN_IN_PANE_MODE, SPLIT_RIGHT_IN_PANE_MODE,
};
@@ -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,
&PANE_MODE,
&SPLIT_RIGHT_IN_PANE_MODE,
&MOVE_FOCUS_LEFT_IN_PANE_MODE,
@@ -54,7 +53,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,
&PANE_MODE,
&SPLIT_RIGHT_IN_PANE_MODE,
&SPLIT_DOWN_IN_PANE_MODE,
diff --git a/src/tests/integration/move_focus_up.rs b/src/tests/integration/move_focus_up.rs
index 8af7a91d..a5c48f11 100644
--- a/src/tests/integration/move_focus_up.rs
+++ b/src/tests/integration/move_focus_up.rs
@@ -6,7 +6,7 @@ use crate::tests::utils::{get_next_to_last_snapshot, get_output_frame_snapshots}
use crate::{start, CliArgs};
use crate::tests::utils::commands::{
- COMMAND_TOGGLE, MOVE_FOCUS_DOWN_IN_PANE_MODE, MOVE_FOCUS_UP_IN_PANE_MODE, PANE_MODE, QUIT,
+ MOVE_FOCUS_DOWN_IN_PANE_MODE, MOVE_FOCUS_UP_IN_PANE_MODE, PANE_MODE, QUIT,
SPLIT_DOWN_IN_PANE_MODE, SPLIT_RIGHT_IN_PANE_MODE,
};
@@ -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,
&PANE_MODE,
&SPLIT_DOWN_IN_PANE_MODE,
&MOVE_FOCUS_UP_IN_PANE_MODE,
@@ -53,7 +52,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,
&PANE_MODE,
&SPLIT_DOWN_IN_PANE_MODE,
&MOVE_FOCUS_UP_IN_PANE_MODE,
diff --git a/src/tests/integration/resize_down.rs b/src/tests/integration/resize_down.rs
index 8bd274c2..4957b33e 100644
--- a/src/tests/integration/resize_down.rs
+++ b/src/tests/integration/resize_down.rs
@@ -6,8 +6,9 @@ use crate::tests::utils::{get_next_to_last_snapshot, get_output_frame_snapshots}
use crate::{start, CliArgs};
use crate::tests::utils::commands::{
- COMMAND_TOGGLE, ESC, MOVE_FOCUS_IN_PANE_MODE, PANE_MODE, QUIT, RESIZE_DOWN_IN_RESIZE_MODE,
- RESIZE_LEFT_IN_RESIZE_MODE, RESIZE_MODE, SPLIT_DOWN_IN_PANE_MODE, SPLIT_RIGHT_IN_PANE_MODE,
+ MOVE_FOCUS_IN_PANE_MODE, PANE_MODE, QUIT, RESIZE_DOWN_IN_RESIZE_MODE,
+ RESIZE_LEFT_IN_RESIZE_MODE, RESIZE_MODE, SLEEP, SPLIT_DOWN_IN_PANE_MODE,
+ SPLIT_RIGHT_IN_PANE_MODE,
};
fn get_fake_os_input(fake_win_size: &PositionAndSize) -> FakeInputOutput {
@@ -33,12 +34,11 @@ 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,
&PANE_MODE,
&SPLIT_DOWN_IN_PANE_MODE,
- &ESC,
&RESIZE_MODE,
&RESIZE_DOWN_IN_RESIZE_MODE,
+ &SLEEP,
&QUIT,
]);
start(Box::new(fake_input_output.clone()), CliArgs::default());
@@ -72,13 +72,12 @@ 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,
&PANE_MODE,
&SPLIT_DOWN_IN_PANE_MODE,
&MOVE_FOCUS_IN_PANE_MODE,
- &ESC,
&RESIZE_MODE,
&RESIZE_DOWN_IN_RESIZE_MODE,
+ &SLEEP,
&QUIT,
]);
start(Box::new(fake_input_output.clone()), CliArgs::default());
@@ -115,15 +114,14 @@ 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,
&PANE_MODE,
&SPLIT_DOWN_IN_PANE_MODE,
&SPLIT_DOWN_IN_PANE_MODE,
&MOVE_FOCUS_IN_PANE_MODE,
&MOVE_FOCUS_IN_PANE_MODE,
- &ESC,
&RESIZE_MODE,
&RESIZE_DOWN_IN_RESIZE_MODE,
+ &SLEEP,
&QUIT,
]);
start(Box::new(fake_input_output.clone()), CliArgs::default());
@@ -158,16 +156,15 @@ 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,
&PANE_MODE,
&SPLIT_DOWN_IN_PANE_MODE,
&MOVE_FOCUS_IN_PANE_MODE,
&SPLIT_RIGHT_IN_PANE_MODE,
&MOVE_FOCUS_IN_PANE_MODE,
&MOVE_FOCUS_IN_PANE_MODE,
- &ESC,
&RESIZE_MODE,
&RESIZE_DOWN_IN_RESIZE_MODE,
+ &SLEEP,
&QUIT,
]);
@@ -203,7 +200,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,
&PANE_MODE,
&SPLIT_RIGHT_IN_PANE_MODE,
&SPLIT_DOWN_IN_PANE_MODE,
@@ -212,9 +208,9 @@ pub fn resize_down_with_panes_above_aligned_left_with_current_pane() {
&MOVE_FOCUS_IN_PANE_MODE,
&MOVE_FOCUS_IN_PANE_MODE,
&MOVE_FOCUS_IN_PANE_MODE,
- &ESC,
&RESIZE_MODE,
&RESIZE_DOWN_IN_RESIZE_MODE,
+ &SLEEP,
&QUIT,
]);
@@ -250,7 +246,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,
&PANE_MODE,
&SPLIT_RIGHT_IN_PANE_MODE,
&SPLIT_DOWN_IN_PANE_MODE,
@@ -258,9 +253,9 @@ pub fn resize_down_with_panes_below_aligned_left_with_current_pane() {
&SPLIT_DOWN_IN_PANE_MODE,
&MOVE_FOCUS_IN_PANE_MODE,
&MOVE_FOCUS_IN_PANE_MODE,
- &ESC,
&RESIZE_MODE,
&RESIZE_DOWN_IN_RESIZE_MODE,
+ &SLEEP,
&QUIT,
]);
@@ -296,15 +291,14 @@ 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,
&PANE_MODE,
&SPLIT_RIGHT_IN_PANE_MODE,
&SPLIT_DOWN_IN_PANE_MODE,
&MOVE_FOCUS_IN_PANE_MODE,
&SPLIT_DOWN_IN_PANE_MODE,
- &ESC,
&RESIZE_MODE,
&RESIZE_DOWN_IN_RESIZE_MODE,
+ &SLEEP,
&QUIT,
]);
@@ -340,16 +334,15 @@ 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,
&PANE_MODE,
&SPLIT_RIGHT_IN_PANE_MODE,
&SPLIT_DOWN_IN_PANE_MODE,
&MOVE_FOCUS_IN_PANE_MODE,
&SPLIT_DOWN_IN_PANE_MODE,
&MOVE_FOCUS_IN_PANE_MODE,
- &ESC,
&RESIZE_MODE,
&RESIZE_DOWN_IN_RESIZE_MODE,
+ &SLEEP,
&QUIT,
]);
@@ -385,7 +378,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,
&PANE_MODE,
&SPLIT_RIGHT_IN_PANE_MODE,
&SPLIT_RIGHT_IN_PANE_MODE,
@@ -395,9 +387,9 @@ pub fn resize_down_with_panes_above_aligned_left_and_right_with_current_pane() {
&MOVE_FOCUS_IN_PANE_MODE,
&MOVE_FOCUS_IN_PANE_MODE,
&SPLIT_DOWN_IN_PANE_MODE,
- &ESC,
&RESIZE_MODE,
&RESIZE_DOWN_IN_RESIZE_MODE,
+ &SLEEP,
&QUIT,
]);
@@ -433,7 +425,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,
&PANE_MODE,
&SPLIT_RIGHT_IN_PANE_MODE,
&SPLIT_RIGHT_IN_PANE_MODE,
@@ -445,9 +436,9 @@ pub fn resize_down_with_panes_below_aligned_left_and_right_with_current_pane() {
&SPLIT_DOWN_IN_PANE_MODE,
&MOVE_FOCUS_IN_PANE_MODE,
&MOVE_FOCUS_IN_PANE_MODE,
- &ESC,
&RESIZE_MODE,
&RESIZE_DOWN_IN_RESIZE_MODE,
+ &SLEEP,
&QUIT,
]);
@@ -483,17 +474,14 @@ 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,
&PANE_MODE,
&SPLIT_RIGHT_IN_PANE_MODE,
&SPLIT_RIGHT_IN_PANE_MODE,
&MOVE_FOCUS_IN_PANE_MODE,
- &ESC,
&RESIZE_MODE,
&RESIZE_LEFT_IN_RESIZE_MODE,
&RESIZE_LEFT_IN_RESIZE_MODE,
&RESIZE_LEFT_IN_RESIZE_MODE,
- &ESC,
&PANE_MODE,
&SPLIT_DOWN_IN_PANE_MODE,
&MOVE_FOCUS_IN_PANE_MODE,
@@ -512,11 +500,11 @@ 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,
&MOVE_FOCUS_IN_PANE_MODE,
- &ESC,
&RESIZE_MODE,
&RESIZE_LEFT_IN_RESIZE_MODE,
&RESIZE_LEFT_IN_RESIZE_MODE,
&RESIZE_DOWN_IN_RESIZE_MODE,
+ &SLEEP,
&QUIT,
]);
@@ -552,17 +540,14 @@ 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,
&PANE_MODE,
&SPLIT_RIGHT_IN_PANE_MODE,
&SPLIT_RIGHT_IN_PANE_MODE,
&MOVE_FOCUS_IN_PANE_MODE,
- &ESC,
&RESIZE_MODE,
&RESIZE_LEFT_IN_RESIZE_MODE,
&RESIZE_LEFT_IN_RESIZE_MODE,
&RESIZE_LEFT_IN_RESIZE_MODE,
- &ESC,
&PANE_MODE,
&SPLIT_DOWN_IN_PANE_MODE,
&MOVE_FOCUS_IN_PANE_MODE,
@@ -583,11 +568,11 @@ 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,
&MOVE_FOCUS_IN_PANE_MODE,
- &ESC,
&RESIZE_MODE,
&RESIZE_LEFT_IN_RESIZE_MODE,
&RESIZE_LEFT_IN_RESIZE_MODE,
&RESIZE_DOWN_IN_RESIZE_MODE,
+ &SLEEP,
&QUIT,
]);
@@ -620,12 +605,11 @@ 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,
&PANE_MODE,
&SPLIT_DOWN_IN_PANE_MODE,
- &ESC,
&RESIZE_MODE,
&RESIZE_DOWN_IN_RESIZE_MODE,
+ &SLEEP,
&QUIT,
]);
start(Box::new(fake_input_output.clone()), CliArgs::default());
diff --git a/src/tests/integration/resize_left.rs b/src/tests/integration/resize_left.rs
index 948b5d30..a9d229d9 100644
--- a/src/tests/integration/resize_left.rs
+++ b/src/tests/integration/resize_left.rs
@@ -6,8 +6,8 @@ use crate::tests::utils::{get_next_to_last_snapshot, get_output_frame_snapshots}
use crate::{start, CliArgs};
use crate::tests::utils::commands::{
- COMMAND_TOGGLE, ESC, MOVE_FOCUS_IN_PANE_MODE, PANE_MODE, QUIT, RESIZE_LEFT_IN_RESIZE_MODE,
- RESIZE_MODE, RESIZE_UP_IN_RESIZE_MODE, SPLIT_DOWN_IN_PANE_MODE, SPLIT_RIGHT_IN_PANE_MODE,
+ MOVE_FOCUS_IN_PANE_MODE, PANE_MODE, QUIT, RESIZE_LEFT_IN_RESIZE_MODE, RESIZE_MODE,
+ RESIZE_UP_IN_RESIZE_MODE, SLEEP, SPLIT_DOWN_IN_PANE_MODE, SPLIT_RIGHT_IN_PANE_MODE,
};
fn get_fake_os_input(fake_win_size: &PositionAndSize) -> FakeInputOutput {
@@ -30,12 +30,11 @@ 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,
&PANE_MODE,
&SPLIT_RIGHT_IN_PANE_MODE,
- &ESC,
&RESIZE_MODE,
&RESIZE_LEFT_IN_RESIZE_MODE,
+ &SLEEP,
&QUIT,
]);
start(Box::new(fake_input_output.clone()), CliArgs::default());
@@ -67,13 +66,12 @@ 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,
&PANE_MODE,
&SPLIT_RIGHT_IN_PANE_MODE,
&MOVE_FOCUS_IN_PANE_MODE,
- &ESC,
&RESIZE_MODE,
&RESIZE_LEFT_IN_RESIZE_MODE,
+ &SLEEP,
&QUIT,
]);
start(Box::new(fake_input_output.clone()), CliArgs::default());
@@ -105,15 +103,14 @@ 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,
&PANE_MODE,
&SPLIT_RIGHT_IN_PANE_MODE,
&SPLIT_RIGHT_IN_PANE_MODE,
&MOVE_FOCUS_IN_PANE_MODE,
&MOVE_FOCUS_IN_PANE_MODE,
- &ESC,
&RESIZE_MODE,
&RESIZE_LEFT_IN_RESIZE_MODE,
+ &SLEEP,
&QUIT,
]);
start(Box::new(fake_input_output.clone()), CliArgs::default());
@@ -146,16 +143,15 @@ 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,
&PANE_MODE,
&SPLIT_RIGHT_IN_PANE_MODE,
&MOVE_FOCUS_IN_PANE_MODE,
&SPLIT_DOWN_IN_PANE_MODE,
&MOVE_FOCUS_IN_PANE_MODE,
&MOVE_FOCUS_IN_PANE_MODE,
- &ESC,
&RESIZE_MODE,
&RESIZE_LEFT_IN_RESIZE_MODE,
+ &SLEEP,
&QUIT,
]);
@@ -189,7 +185,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,
&PANE_MODE,
&SPLIT_RIGHT_IN_PANE_MODE,
&SPLIT_DOWN_IN_PANE_MODE,
@@ -198,9 +193,9 @@ pub fn resize_left_with_panes_to_the_left_aligned_top_with_current_pane() {
&MOVE_FOCUS_IN_PANE_MODE,
&MOVE_FOCUS_IN_PANE_MODE,
&MOVE_FOCUS_IN_PANE_MODE,
- &ESC,
&RESIZE_MODE,
&RESIZE_LEFT_IN_RESIZE_MODE,
+ &SLEEP,
&QUIT,
]);
@@ -234,15 +229,14 @@ 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,
&PANE_MODE,
&SPLIT_RIGHT_IN_PANE_MODE,
&SPLIT_DOWN_IN_PANE_MODE,
&MOVE_FOCUS_IN_PANE_MODE,
&SPLIT_DOWN_IN_PANE_MODE,
- &ESC,
&RESIZE_MODE,
&RESIZE_LEFT_IN_RESIZE_MODE,
+ &SLEEP,
&QUIT,
]);
@@ -276,7 +270,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,
&PANE_MODE,
&SPLIT_RIGHT_IN_PANE_MODE,
&SPLIT_DOWN_IN_PANE_MODE,
@@ -284,9 +277,9 @@ pub fn resize_left_with_panes_to_the_left_aligned_bottom_with_current_pane() {
&SPLIT_DOWN_IN_PANE_MODE,
&MOVE_FOCUS_IN_PANE_MODE,
&MOVE_FOCUS_IN_PANE_MODE,
- &ESC,
&RESIZE_MODE,
&RESIZE_LEFT_IN_RESIZE_MODE,
+ &SLEEP,
&QUIT,
]);
@@ -320,16 +313,15 @@ 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,
&PANE_MODE,
&SPLIT_RIGHT_IN_PANE_MODE,
&SPLIT_DOWN_IN_PANE_MODE,
&MOVE_FOCUS_IN_PANE_MODE,
&SPLIT_DOWN_IN_PANE_MODE,
&MOVE_FOCUS_IN_PANE_MODE,
- &ESC,
&RESIZE_MODE,
&RESIZE_LEFT_IN_RESIZE_MODE,
+ &SLEEP,
&QUIT,
]);
@@ -365,7 +357,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,
&PANE_MODE,
&SPLIT_DOWN_IN_PANE_MODE,
&SPLIT_DOWN_IN_PANE_MODE,
@@ -375,9 +366,9 @@ pub fn resize_left_with_panes_to_the_left_aligned_top_and_bottom_with_current_pa
&MOVE_FOCUS_IN_PANE_MODE,
&MOVE_FOCUS_IN_PANE_MODE,
&SPLIT_RIGHT_IN_PANE_MODE,
- &ESC,
&RESIZE_MODE,
&RESIZE_LEFT_IN_RESIZE_MODE,
+ &SLEEP,
&QUIT,
]);
@@ -413,7 +404,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,
&PANE_MODE,
&SPLIT_DOWN_IN_PANE_MODE,
&SPLIT_DOWN_IN_PANE_MODE,
@@ -425,9 +415,9 @@ pub fn resize_left_with_panes_to_the_right_aligned_top_and_bottom_with_current_p
&SPLIT_RIGHT_IN_PANE_MODE,
&MOVE_FOCUS_IN_PANE_MODE,
&MOVE_FOCUS_IN_PANE_MODE,
- &ESC,
&RESIZE_MODE,
&RESIZE_LEFT_IN_RESIZE_MODE,
+ &SLEEP,
&QUIT,
]);
@@ -463,17 +453,14 @@ 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,
&PANE_MODE,
&SPLIT_DOWN_IN_PANE_MODE,
&SPLIT_DOWN_IN_PANE_MODE,
&MOVE_FOCUS_IN_PANE_MODE,
- &ESC,
&RESIZE_MODE,
&RESIZE_UP_IN_RESIZE_MODE,
&RESIZE_UP_IN_RESIZE_MODE,
&RESIZE_UP_IN_RESIZE_MODE,
- &ESC,
&PANE_MODE,
&SPLIT_RIGHT_IN_PANE_MODE,
&MOVE_FOCUS_IN_PANE_MODE,
@@ -492,11 +479,11 @@ 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,
&MOVE_FOCUS_IN_PANE_MODE,
- &ESC,
&RESIZE_MODE,
&RESIZE_UP_IN_RESIZE_MODE,
&RESIZE_UP_IN_RESIZE_MODE,
&RESIZE_LEFT_IN_RESIZE_MODE,
+ &SLEEP,
&QUIT,
]);
@@ -533,17 +520,14 @@ 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,
&PANE_MODE,
&SPLIT_DOWN_IN_PANE_MODE,
&SPLIT_DOWN_IN_PANE_MODE,
&MOVE_FOCUS_IN_PANE_MODE,
- &ESC,
&RESIZE_MODE,
&RESIZE_UP_IN_RESIZE_MODE,
&RESIZE_UP_IN_RESIZE_MODE,
&RESIZE_UP_IN_RESIZE_MODE,
- &ESC,
&PANE_MODE,
&SPLIT_RIGHT_IN_PANE_MODE,
&MOVE_FOCUS_IN_PANE_MODE,
@@ -564,11 +548,11 @@ 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,
&MOVE_FOCUS_IN_PANE_MODE,
- &ESC,
&RESIZE_MODE,
&RESIZE_UP_IN_RESIZE_MODE,
&RESIZE_UP_IN_RESIZE_MODE,
&RESIZE_LEFT_IN_RESIZE_MODE,
+ &SLEEP,
&QUIT,
]);
@@ -601,12 +585,11 @@ 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,
&PANE_MODE,
&SPLIT_RIGHT_IN_PANE_MODE,
- &ESC,
&RESIZE_MODE,
&RESIZE_LEFT_IN_RESIZE_MODE,
+ &SLEEP,
&QUIT,
]);
start(Box::new(fake_input_output.clone()), CliArgs::default());
diff --git a/src/tests/integration/resize_right.rs b/src/tests/integration/resize_right.rs
index d1eac8bf..fef33e84 100644
--- a/src/tests/integration/resize_right.rs
+++ b/src/tests/integration/resize_right.rs
@@ -6,9 +6,8 @@ use crate::tests::utils::{get_next_to_last_snapshot, get_output_frame_snapshots}
use crate::{start, CliArgs};
use crate::tests::utils::commands::{
- COMMAND_TOGGLE, ESC, MOVE_FOCUS_IN_PANE_MODE, PANE_MODE, QUIT, RESIZE_MODE,
- RESIZE_RIGHT_IN_RESIZE_MODE, RESIZE_UP_IN_RESIZE_MODE, SPLIT_DOWN_IN_PANE_MODE,
- SPLIT_RIGHT_IN_PANE_MODE,
+ MOVE_FOCUS_IN_PANE_MODE, PANE_MODE, QUIT, RESIZE_MODE, RESIZE_RIGHT_IN_RESIZE_MODE,
+ RESIZE_UP_IN_RESIZE_MODE, SLEEP, SPLIT_DOWN_IN_PANE_MODE, SPLIT_RIGHT_IN_PANE_MODE,
};
fn get_fake_os_input(fake_win_size: &PositionAndSize) -> FakeInputOutput {
@@ -31,12 +30,11 @@ 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,
&PANE_MODE,
&SPLIT_RIGHT_IN_PANE_MODE,
- &ESC,
&RESIZE_MODE,
&RESIZE_RIGHT_IN_RESIZE_MODE,
+ &SLEEP,
&QUIT,
]);
start(Box::new(fake_input_output.clone()), CliArgs::default());
@@ -68,13 +66,12 @@ 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,
&PANE_MODE,
&SPLIT_RIGHT_IN_PANE_MODE,
&MOVE_FOCUS_IN_PANE_MODE,
- &ESC,
&RESIZE_MODE,
&RESIZE_RIGHT_IN_RESIZE_MODE,
+ &SLEEP,
&QUIT,
]);
start(Box::new(fake_input_output.clone()), CliArgs::default());
@@ -106,15 +103,14 @@ 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,
&PANE_MODE,
&SPLIT_RIGHT_IN_PANE_MODE,
&SPLIT_RIGHT_IN_PANE_MODE,
&MOVE_FOCUS_IN_PANE_MODE,
&MOVE_FOCUS_IN_PANE_MODE,
- &ESC,
&RESIZE_MODE,
&RESIZE_RIGHT_IN_RESIZE_MODE,
+ &SLEEP,
&QUIT,
]);
start(Box::new(fake_input_output.clone()), CliArgs::default());
@@ -147,16 +143,15 @@ 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,
&PANE_MODE,
&SPLIT_RIGHT_IN_PANE_MODE,
&MOVE_FOCUS_IN_PANE_MODE,
&SPLIT_DOWN_IN_PANE_MODE,
&MOVE_FOCUS_IN_PANE_MODE,
&MOVE_FOCUS_IN_PANE_MODE,
- &ESC,
&RESIZE_MODE,
&RESIZE_RIGHT_IN_RESIZE_MODE,
+ &SLEEP,
&QUIT,
]);
@@ -190,7 +185,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,
&PANE_MODE,
&SPLIT_RIGHT_IN_PANE_MODE,
&SPLIT_DOWN_IN_PANE_MODE,
@@ -199,9 +193,9 @@ pub fn resize_right_with_panes_to_the_left_aligned_top_with_current_pane() {
&MOVE_FOCUS_IN_PANE_MODE,
&MOVE_FOCUS_IN_PANE_MODE,
&MOVE_FOCUS_IN_PANE_MODE,
- &ESC,
&RESIZE_MODE,
&RESIZE_RIGHT_IN_RESIZE_MODE,
+ &SLEEP,
&QUIT,
]);
@@ -235,15 +229,14 @@ 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,
&PANE_MODE,
&SPLIT_RIGHT_IN_PANE_MODE,
&SPLIT_DOWN_IN_PANE_MODE,
&MOVE_FOCUS_IN_PANE_MODE,
&SPLIT_DOWN_IN_PANE_MODE,
- &ESC,
&RESIZE_MODE,
&RESIZE_RIGHT_IN_RESIZE_MODE,
+ &SLEEP,
&QUIT,
]);
@@ -277,7 +270,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,
&PANE_MODE,
&SPLIT_RIGHT_IN_PANE_MODE,
&SPLIT_DOWN_IN_PANE_MODE,
@@ -285,9 +277,9 @@ pub fn resize_right_with_panes_to_the_left_aligned_bottom_with_current_pane() {
&SPLIT_DOWN_IN_PANE_MODE,
&MOVE_FOCUS_IN_PANE_MODE,
&MOVE_FOCUS_IN_PANE_MODE,
- &ESC,
&RESIZE_MODE,
&RESIZE_RIGHT_IN_RESIZE_MODE,
+ &SLEEP,
&QUIT,
]);
@@ -321,16 +313,15 @@ 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,
&PANE_MODE,
&SPLIT_RIGHT_IN_PANE_MODE,
&SPLIT_DOWN_IN_PANE_MODE,
&MOVE_FOCUS_IN_PANE_MODE,
&SPLIT_DOWN_IN_PANE_MODE,
&MOVE_FOCUS_IN_PANE_MODE,
- &ESC,
&RESIZE_MODE,
&RESIZE_RIGHT_IN_RESIZE_MODE,
+ &SLEEP,
&QUIT,
]);
@@ -366,7 +357,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,
&PANE_MODE,
&SPLIT_DOWN_IN_PANE_MODE,
&SPLIT_DOWN_IN_PANE_MODE,
@@ -376,9 +366,9 @@ pub fn resize_right_with_panes_to_the_left_aligned_top_and_bottom_with_current_p
&MOVE_FOCUS_IN_PANE_MODE,
&MOVE_FOCUS_IN_PANE_MODE,
&SPLIT_RIGHT_IN_PANE_MODE,
- &ESC,
&RESIZE_MODE,
&RESIZE_RIGHT_IN_RESIZE_MODE,
+ &SLEEP,
&QUIT,
]);
@@ -414,7 +404,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,
&PANE_MODE,
&SPLIT_DOWN_IN_PANE_MODE,
&SPLIT_DOWN_IN_PANE_MODE,
@@ -426,9 +415,9 @@ pub fn resize_right_with_panes_to_the_right_aligned_top_and_bottom_with_current_
&SPLIT_RIGHT_IN_PANE_MODE,
&MOVE_FOCUS_IN_PANE_MODE,
&MOVE_FOCUS_IN_PANE_MODE,
- &ESC,
&RESIZE_MODE,
&RESIZE_RIGHT_IN_RESIZE_MODE,
+ &SLEEP,
&QUIT,
]);
@@ -464,17 +453,14 @@ 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,
&PANE_MODE,
&SPLIT_DOWN_IN_PANE_MODE,
&SPLIT_DOWN_IN_PANE_MODE,
&MOVE_FOCUS_IN_PANE_MODE,
- &ESC,
&RESIZE_MODE,
&RESIZE_UP_IN_RESIZE_MODE,
&RESIZE_UP_IN_RESIZE_MODE,
&RESIZE_UP_IN_RESIZE_MODE,
- &ESC,
&PANE_MODE,
&SPLIT_RIGHT_IN_PANE_MODE,
&MOVE_FOCUS_IN_PANE_MODE,
@@ -493,11 +479,11 @@ 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,
&MOVE_FOCUS_IN_PANE_MODE,
- &ESC,
&RESIZE_MODE,
&RESIZE_UP_IN_RESIZE_MODE,
&RESIZE_UP_IN_RESIZE_MODE,
&RESIZE_RIGHT_IN_RESIZE_MODE,
+ &SLEEP,
&QUIT,
]);
@@ -533,17 +519,14 @@ 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,
&PANE_MODE,
&SPLIT_DOWN_IN_PANE_MODE,
&SPLIT_DOWN_IN_PANE_MODE,
&MOVE_FOCUS_IN_PANE_MODE,
- &ESC,
&RESIZE_MODE,
&RESIZE_UP_IN_RESIZE_MODE,
&RESIZE_UP_IN_RESIZE_MODE,
&RESIZE_UP_IN_RESIZE_MODE,
- &ESC,
&PANE_MODE,
&SPLIT_RIGHT_IN_PANE_MODE,
&MOVE_FOCUS_IN_PANE_MODE,
@@ -564,11 +547,11 @@ 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,
&MOVE_FOCUS_IN_PANE_MODE,
- &ESC,
&RESIZE_MODE,
&RESIZE_UP_IN_RESIZE_MODE,
&RESIZE_UP_IN_RESIZE_MODE,
&RESIZE_RIGHT_IN_RESIZE_MODE,
+ &SLEEP,
&QUIT,
]);
@@ -601,12 +584,11 @@ 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,
&PANE_MODE,
&SPLIT_RIGHT_IN_PANE_MODE,
- &ESC,
&RESIZE_MODE,
&RESIZE_RIGHT_IN_RESIZE_MODE,
+ &SLEEP,
&QUIT,
]);
start(Box::new(fake_input_output.clone()), CliArgs::default());
diff --git a/src/tests/integration/resize_up.rs b/src/tests/integration/resize_up.rs
index 20b70c42..9d4dd05a 100644
--- a/src/tests/integration/resize_up.rs
+++ b/src/tests/integration/resize_up.rs
@@ -6,8 +6,8 @@ use crate::tests::utils::{get_next_to_last_snapshot, get_output_frame_snapshots}
use crate::{start, CliArgs};
use crate::tests::utils::commands::{
- COMMAND_TOGGLE, ESC, MOVE_FOCUS_IN_PANE_MODE, PANE_MODE, QUIT, RESIZE_LEFT_IN_RESIZE_MODE,
- RESIZE_MODE, RESIZE_UP_IN_RESIZE_MODE, SPLIT_DOWN_IN_PANE_MODE, SPLIT_RIGHT_IN_PANE_MODE,
+ MOVE_FOCUS_IN_PANE_MODE, PANE_MODE, QUIT, RESIZE_LEFT_IN_RESIZE_MODE, RESIZE_MODE,
+ RESIZE_UP_IN_RESIZE_MODE, SLEEP, SPLIT_DOWN_IN_PANE_MODE, SPLIT_RIGHT_IN_PANE_MODE,
};
fn get_fake_os_input(fake_win_size: &PositionAndSize) -> FakeInputOutput {
@@ -32,12 +32,11 @@ 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,
&PANE_MODE,
&SPLIT_DOWN_IN_PANE_MODE,
- &ESC,
&RESIZE_MODE,
&RESIZE_UP_IN_RESIZE_MODE,
+ &SLEEP,
&QUIT,
]);
start(Box::new(fake_input_output.clone()), CliArgs::default());
@@ -71,13 +70,12 @@ 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,
&PANE_MODE,
&SPLIT_DOWN_IN_PANE_MODE,
&MOVE_FOCUS_IN_PANE_MODE,
- &ESC,
&RESIZE_MODE,
&RESIZE_UP_IN_RESIZE_MODE,
+ &SLEEP,
&QUIT,
]);
start(Box::new(fake_input_output.clone()), CliArgs::default());
@@ -114,15 +112,14 @@ 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,
&PANE_MODE,
&SPLIT_DOWN_IN_PANE_MODE,
&SPLIT_DOWN_IN_PANE_MODE,
&MOVE_FOCUS_IN_PANE_MODE,
&MOVE_FOCUS_IN_PANE_MODE,
- &ESC,
&RESIZE_MODE,
&RESIZE_UP_IN_RESIZE_MODE,
+ &SLEEP,
&QUIT,
]);
start(Box::new(fake_input_output.clone()), CliArgs::default());
@@ -156,16 +153,15 @@ 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,
&PANE_MODE,
&SPLIT_DOWN_IN_PANE_MODE,
&MOVE_FOCUS_IN_PANE_MODE,
&SPLIT_RIGHT_IN_PANE_MODE,
&MOVE_FOCUS_IN_PANE_MODE,
&MOVE_FOCUS_IN_PANE_MODE,
- &ESC,
&RESIZE_MODE,
&RESIZE_UP_IN_RESIZE_MODE,
+ &SLEEP,
&QUIT,
]);
@@ -199,7 +195,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,
&PANE_MODE,
&SPLIT_RIGHT_IN_PANE_MODE,
&SPLIT_DOWN_IN_PANE_MODE,
@@ -208,9 +203,9 @@ pub fn resize_up_with_panes_above_aligned_left_with_current_pane() {
&MOVE_FOCUS_IN_PANE_MODE,
&MOVE_FOCUS_IN_PANE_MODE,
&MOVE_FOCUS_IN_PANE_MODE,
- &ESC,
&RESIZE_MODE,
&RESIZE_UP_IN_RESIZE_MODE,
+ &SLEEP,
&QUIT,
]);
@@ -246,7 +241,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,
&PANE_MODE,
&SPLIT_RIGHT_IN_PANE_MODE,
&SPLIT_DOWN_IN_PANE_MODE,
@@ -254,9 +248,9 @@ pub fn resize_up_with_panes_below_aligned_left_with_current_pane() {
&SPLIT_DOWN_IN_PANE_MODE,
&MOVE_FOCUS_IN_PANE_MODE,
&MOVE_FOCUS_IN_PANE_MODE,
- &ESC,
&RESIZE_MODE,
&RESIZE_UP_IN_RESIZE_MODE,
+ &SLEEP,
&QUIT,
]);
@@ -292,15 +286,14 @@ 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,
&PANE_MODE,
&SPLIT_RIGHT_IN_PANE_MODE,
&SPLIT_DOWN_IN_PANE_MODE,
&MOVE_FOCUS_IN_PANE_MODE,
&SPLIT_DOWN_IN_PANE_MODE,
- &ESC,
&RESIZE_MODE,
&RESIZE_UP_IN_RESIZE_MODE,
+ &SLEEP,
&QUIT,
]);
@@ -336,16 +329,15 @@ 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,
&PANE_MODE,
&SPLIT_RIGHT_IN_PANE_MODE,
&SPLIT_DOWN_IN_PANE_MODE,
&MOVE_FOCUS_IN_PANE_MODE,
&SPLIT_DOWN_IN_PANE_MODE,
&MOVE_FOCUS_IN_PANE_MODE,
- &ESC,
&RESIZE_MODE,
&RESIZE_UP_IN_RESIZE_MODE,
+ &SLEEP,
&QUIT,
]);
@@ -381,7 +373,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,
&PANE_MODE,
&SPLIT_RIGHT_IN_PANE_MODE,
&SPLIT_RIGHT_IN_PANE_MODE,
@@ -391,9 +382,9 @@ pub fn resize_up_with_panes_above_aligned_left_and_right_with_current_pane() {
&MOVE_FOCUS_IN_PANE_MODE,
&MOVE_FOCUS_IN_PANE_MODE,
&SPLIT_DOWN_IN_PANE_MODE,
- &ESC,
&RESIZE_MODE,
&RESIZE_UP_IN_RESIZE_MODE,
+ &SLEEP,
&QUIT,
]);
@@ -429,7 +420,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,
&PANE_MODE,
&SPLIT_RIGHT_IN_PANE_MODE,
&SPLIT_RIGHT_IN_PANE_MODE,
@@ -441,9 +431,9 @@ pub fn resize_up_with_panes_below_aligned_left_and_right_with_current_pane() {
&SPLIT_DOWN_IN_PANE_MODE,
&MOVE_FOCUS_IN_PANE_MODE,
&MOVE_FOCUS_IN_PANE_MODE,
- &ESC,
&RESIZE_MODE,
&RESIZE_UP_IN_RESIZE_MODE,
+ &SLEEP,
&QUIT,
]);
@@ -479,17 +469,14 @@ 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,
&PANE_MODE,
&SPLIT_RIGHT_IN_PANE_MODE,
&SPLIT_RIGHT_IN_PANE_MODE,
&MOVE_FOCUS_IN_PANE_MODE,
- &ESC,
&RESIZE_MODE,
&RESIZE_LEFT_IN_RESIZE_MODE,
&RESIZE_LEFT_IN_RESIZE_MODE,
&RESIZE_LEFT_IN_RESIZE_MODE,
- &ESC,
&PANE_MODE,
&SPLIT_DOWN_IN_PANE_MODE,
&MOVE_FOCUS_IN_PANE_MODE,
@@ -508,11 +495,11 @@ 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,
&MOVE_FOCUS_IN_PANE_MODE,
- &ESC,
&RESIZE_MODE,
&RESIZE_LEFT_IN_RESIZE_MODE,
&RESIZE_LEFT_IN_RESIZE_MODE,
&RESIZE_UP_IN_RESIZE_MODE,
+ &SLEEP,
&QUIT,
]);
@@ -548,17 +535,14 @@ 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,
&PANE_MODE,
&SPLIT_RIGHT_IN_PANE_MODE,
&SPLIT_RIGHT_IN_PANE_MODE,
&MOVE_FOCUS_IN_PANE_MODE,
- &ESC,
&RESIZE_MODE,
&RESIZE_LEFT_IN_RESIZE_MODE,
&RESIZE_LEFT_IN_RESIZE_MODE,
&RESIZE_LEFT_IN_RESIZE_MODE,
- &ESC,
&PANE_MODE,
&SPLIT_DOWN_IN_PANE_MODE,
&MOVE_FOCUS_IN_PANE_MODE,
@@ -579,11 +563,11 @@ 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,
&MOVE_FOCUS_IN_PANE_MODE,
- &ESC,
&RESIZE_MODE,
&RESIZE_LEFT_IN_RESIZE_MODE,
&RESIZE_LEFT_IN_RESIZE_MODE,
&RESIZE_UP_IN_RESIZE_MODE,
+ &SLEEP,
&QUIT,
]);
@@ -616,12 +600,11 @@ 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,
&PANE_MODE,
&SPLIT_DOWN_IN_PANE_MODE,
- &ESC,
&RESIZE_MODE,
&RESIZE_UP_IN_RESIZE_MODE,
+ &SLEEP,
&QUIT,
]);
start(Box::new(fake_input_output.clone()), CliArgs::default());
diff --git a/src/tests/integration/tabs.rs b/src/tests/integration/tabs.rs
index 17a0fc1b..ee75b3a9 100644
--- a/src/tests/integration/tabs.rs
+++ b/src/tests/integration/tabs.rs
@@ -6,8 +6,8 @@ use crate::{panes::PositionAndSize, tests::utils::commands::CLOSE_PANE_IN_PANE_M
use crate::{start, CliArgs};
use crate::tests::utils::commands::{
- CLOSE_TAB_IN_TAB_MODE, COMMAND_TOGGLE, ESC, NEW_TAB_IN_TAB_MODE, PANE_MODE, QUIT,
- SPLIT_DOWN_IN_PANE_MODE, SWITCH_NEXT_TAB_IN_TAB_MODE, SWITCH_PREV_TAB_IN_TAB_MODE, TAB_MODE,
+ CLOSE_TAB_IN_TAB_MODE, NEW_TAB_IN_TAB_MODE, PANE_MODE, QUIT, SPLIT_DOWN_IN_PANE_MODE,
+ SWITCH_NEXT_TAB_IN_TAB_MODE, SWITCH_PREV_TAB_IN_TAB_MODE, TAB_MODE,
TOGGLE_ACTIVE_TERMINAL_FULLSCREEN_IN_PANE_MODE,
};
@@ -25,10 +25,8 @@ 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,
&PANE_MODE,
&SPLIT_DOWN_IN_PANE_MODE,
- &ESC,
&TAB_MODE,
&NEW_TAB_IN_TAB_MODE,
&QUIT,
@@ -56,10 +54,8 @@ 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,
&PANE_MODE,
&SPLIT_DOWN_IN_PANE_MODE,
- &ESC,
&TAB_MODE,
&NEW_TAB_IN_TAB_MODE,
&SWITCH_PREV_TAB_IN_TAB_MODE,
@@ -88,10 +84,8 @@ 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,
&PANE_MODE,
&SPLIT_DOWN_IN_PANE_MODE,
- &ESC,
&TAB_MODE,
&NEW_TAB_IN_TAB_MODE,
&SWITCH_NEXT_TAB_IN_TAB_MODE,
@@ -120,10 +114,8 @@ pub fn close_tab() {
};
let mut fake_input_output = get_fake_os_input(&fake_win_size);
fake_input_output.add_terminal_input(&[
- &COMMAND_TOGGLE,
&PANE_MODE,
&SPLIT_DOWN_IN_PANE_MODE,
- &ESC,
&TAB_MODE,
&NEW_TAB_IN_TAB_MODE,
&CLOSE_TAB_IN_TAB_MODE,
@@ -152,10 +144,8 @@ 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,
&TAB_MODE,
&NEW_TAB_IN_TAB_MODE,
- &ESC,
&PANE_MODE,
&SPLIT_DOWN_IN_PANE_MODE,
&CLOSE_PANE_IN_PANE_MODE,
@@ -185,13 +175,10 @@ 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,
&TAB_MODE,
&NEW_TAB_IN_TAB_MODE,
- &ESC,
&PANE_MODE,
&SPLIT_DOWN_IN_PANE_MODE,
- &ESC,
&TAB_MODE,
&NEW_TAB_IN_TAB_MODE,
&SWITCH_PREV_TAB_IN_TAB_MODE,
@@ -221,23 +208,17 @@ 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,
&PANE_MODE,
&SPLIT_DOWN_IN_PANE_MODE,
- &ESC,
&TAB_MODE,
&NEW_TAB_IN_TAB_MODE,
- &ESC,
&PANE_MODE,
&SPLIT_DOWN_IN_PANE_MODE,
- &ESC,
&TAB_MODE,
&NEW_TAB_IN_TAB_MODE,
&SWITCH_PREV_TAB_IN_TAB_MODE,
- &ESC,
&PANE_MODE,
&TOGGLE_ACTIVE_TERMINAL_FULLSCREEN_IN_PANE_MODE,
- &ESC,
&TAB_MODE,
&CLOSE_TAB_IN_TAB_MODE,
&QUIT,
@@ -265,10 +246,8 @@ 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,
&PANE_MODE,
&SPLIT_DOWN_IN_PANE_MODE,
- &ESC,
&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 3ac1103e..840302e5 100644
--- a/src/tests/integration/toggle_fullscreen.rs
+++ b/src/tests/integration/toggle_fullscreen.rs
@@ -6,8 +6,8 @@ use crate::tests::utils::{get_next_to_last_snapshot, get_output_frame_snapshots}
use crate::{start, CliArgs};
use crate::tests::utils::commands::{
- COMMAND_TOGGLE, MOVE_FOCUS_IN_PANE_MODE, PANE_MODE, QUIT, SPLIT_DOWN_IN_PANE_MODE,
- SPLIT_RIGHT_IN_PANE_MODE, TOGGLE_ACTIVE_TERMINAL_FULLSCREEN_IN_PANE_MODE,
+ MOVE_FOCUS_IN_PANE_MODE, PANE_MODE, QUIT, SPLIT_DOWN_IN_PANE_MODE, SPLIT_RIGHT_IN_PANE_MODE,
+ TOGGLE_ACTIVE_TERMINAL_FULLSCREEN_IN_PANE_MODE,
};
fn get_fake_os_input(fake_win_size: &PositionAndSize) -> FakeInputOutput {
@@ -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,
&PANE_MODE,
&SPLIT_RIGHT_IN_PANE_MODE,
&TOGGLE_ACTIVE_TERMINAL_FULLSCREEN_IN_PANE_MODE,
@@ -54,7 +53,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,
&PANE_MODE,
&SPLIT_RIGHT_IN_PANE_MODE,
&TOGGLE_ACTIVE_TERMINAL_FULLSCREEN_IN_PANE_MODE,
diff --git a/src/tests/utils.rs b/src/tests/utils.rs
index 587d36fd..14f4cfa0 100644
--- a/src/tests/utils.rs
+++ b/src/tests/utils.rs
@@ -46,10 +46,10 @@ pub fn get_next_to_last_snapshot(mut snapshots: Vec<String>) -> Option<String> {
pub mod commands {
pub const COMMAND_TOGGLE: [u8; 1] = [7]; // ctrl-g
- pub const QUIT: [u8; 1] = [113]; // q
+ pub const QUIT: [u8; 1] = [17]; // ctrl-q
pub const ESC: [u8; 1] = [27];
- pub const PANE_MODE: [u8; 1] = [112]; // p
+ pub const PANE_MODE: [u8; 1] = [16]; // ctrl-p
pub const SPAWN_TERMINAL_IN_PANE_MODE: [u8; 1] = [110]; // n
pub const MOVE_FOCUS_IN_PANE_MODE: [u8; 1] = [112]; // p
pub const SPLIT_DOWN_IN_PANE_MODE: [u8; 1] = [100]; // d
@@ -61,19 +61,20 @@ pub mod commands {
pub const MOVE_FOCUS_LEFT_IN_PANE_MODE: [u8; 1] = [104]; // h
pub const MOVE_FOCUS_RIGHT_IN_PANE_MODE: [u8; 1] = [108]; // l
- pub const SCROLL_MODE: [u8; 1] = [115]; // s
+ pub const SCROLL_MODE: [u8; 1] = [19]; // ctrl-s
pub const SCROLL_UP_IN_SCROLL_MODE: [u8; 1] = [107]; // k
pub const SCROLL_DOWN_IN_SCROLL_MODE: [u8; 1] = [106]; // j
- pub const RESIZE_MODE: [u8; 1] = [114]; // r
+ pub const RESIZE_MODE: [u8; 1] = [18]; // ctrl-r
pub const RESIZE_DOWN_IN_RESIZE_MODE: [u8; 1] = [106]; // j
pub const RESIZE_UP_IN_RESIZE_MODE: [u8; 1] = [107]; // k
pub const RESIZE_LEFT_IN_RESIZE_MODE: [u8; 1] = [104]; // h
pub const RESIZE_RIGHT_IN_RESIZE_MODE: [u8; 1] = [108]; // l
- pub const TAB_MODE: [u8; 1] = [116]; // t
+ pub const TAB_MODE: [u8; 1] = [20]; // ctrl-t
pub const NEW_TAB_IN_TAB_MODE: [u8; 1] = [110]; // n
pub const SWITCH_NEXT_TAB_IN_TAB_MODE: [u8; 1] = [108]; // l
pub const SWITCH_PREV_TAB_IN_TAB_MODE: [u8; 1] = [104]; // h
pub const CLOSE_TAB_IN_TAB_MODE: [u8; 1] = [120]; // x
+ pub const SLEEP: [u8; 0] = [];
}