Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a command mode #42

Merged
merged 13 commits into from
Nov 21, 2020
Merged
Prev Previous commit
Next Next commit
style(format): make rustfmt happy
  • Loading branch information
imsnif committed Nov 19, 2020
commit 491b1eecc386557f2d96d04f10c3e3280c40be52
4 changes: 2 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
mod tests;

mod boundaries;
mod input;
mod command_is_executing;
mod input;
mod layout;
mod os_input_output;
mod pty_bus;
Expand All @@ -21,8 +21,8 @@ use serde::{Deserialize, Serialize};
use serde_yaml;
use structopt::StructOpt;

use crate::input::input_loop;
use crate::command_is_executing::CommandIsExecuting;
use crate::input::input_loop;
use crate::layout::Layout;
use crate::os_input_output::{get_os_input, OsApi};
use crate::pty_bus::{PtyBus, PtyInstruction, VteEvent};
Expand Down
2 changes: 1 addition & 1 deletion src/tests/fakes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ impl Read for FakeStdinReader {
}
self.read_position += 1;
Ok(bytes_to_read.len())
},
}
None => {
// what is happening here?
//
Expand Down
57 changes: 45 additions & 12 deletions src/tests/integration/resize_up.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,13 @@ pub fn resize_up_with_pane_above() {
y: 0,
};
let mut fake_input_output = get_fake_os_input(&fake_win_size);
fake_input_output.add_terminal_input(&[COMMAND_TOGGLE, COMMAND_TOGGLE, SPLIT_HORIZONTALLY, RESIZE_UP, QUIT]);
fake_input_output.add_terminal_input(&[
COMMAND_TOGGLE,
COMMAND_TOGGLE,
SPLIT_HORIZONTALLY,
RESIZE_UP,
QUIT,
]);
start(Box::new(fake_input_output.clone()), Opt::default());

let output_frames = fake_input_output
Expand Down Expand Up @@ -61,7 +67,14 @@ pub fn resize_up_with_pane_below() {
y: 0,
};
let mut fake_input_output = get_fake_os_input(&fake_win_size);
fake_input_output.add_terminal_input(&[COMMAND_TOGGLE, COMMAND_TOGGLE, SPLIT_HORIZONTALLY, MOVE_FOCUS, RESIZE_UP, QUIT]);
fake_input_output.add_terminal_input(&[
COMMAND_TOGGLE,
COMMAND_TOGGLE,
SPLIT_HORIZONTALLY,
MOVE_FOCUS,
RESIZE_UP,
QUIT,
]);
start(Box::new(fake_input_output.clone()), Opt::default());

let output_frames = fake_input_output
Expand Down Expand Up @@ -95,7 +108,9 @@ pub fn resize_up_with_panes_above_and_below() {
y: 0,
};
let mut fake_input_output = get_fake_os_input(&fake_win_size);
fake_input_output.add_terminal_input(&[COMMAND_TOGGLE, COMMAND_TOGGLE,
fake_input_output.add_terminal_input(&[
COMMAND_TOGGLE,
COMMAND_TOGGLE,
SPLIT_HORIZONTALLY,
SPLIT_HORIZONTALLY,
MOVE_FOCUS,
Expand Down Expand Up @@ -133,7 +148,9 @@ pub fn resize_up_with_multiple_panes_above() {
};
let mut fake_input_output = get_fake_os_input(&fake_win_size);

fake_input_output.add_terminal_input(&[COMMAND_TOGGLE, COMMAND_TOGGLE,
fake_input_output.add_terminal_input(&[
COMMAND_TOGGLE,
COMMAND_TOGGLE,
SPLIT_HORIZONTALLY,
MOVE_FOCUS,
SPLIT_VERTICALLY,
Expand Down Expand Up @@ -172,7 +189,9 @@ pub fn resize_up_with_panes_above_aligned_left_with_current_pane() {
};
let mut fake_input_output = get_fake_os_input(&fake_win_size);

fake_input_output.add_terminal_input(&[COMMAND_TOGGLE, COMMAND_TOGGLE,
fake_input_output.add_terminal_input(&[
COMMAND_TOGGLE,
COMMAND_TOGGLE,
SPLIT_VERTICALLY,
SPLIT_HORIZONTALLY,
MOVE_FOCUS,
Expand Down Expand Up @@ -215,7 +234,9 @@ pub fn resize_up_with_panes_below_aligned_left_with_current_pane() {
};
let mut fake_input_output = get_fake_os_input(&fake_win_size);

fake_input_output.add_terminal_input(&[COMMAND_TOGGLE, COMMAND_TOGGLE,
fake_input_output.add_terminal_input(&[
COMMAND_TOGGLE,
COMMAND_TOGGLE,
SPLIT_VERTICALLY,
SPLIT_HORIZONTALLY,
MOVE_FOCUS,
Expand Down Expand Up @@ -257,7 +278,9 @@ pub fn resize_up_with_panes_above_aligned_right_with_current_pane() {
};
let mut fake_input_output = get_fake_os_input(&fake_win_size);

fake_input_output.add_terminal_input(&[COMMAND_TOGGLE, COMMAND_TOGGLE,
fake_input_output.add_terminal_input(&[
COMMAND_TOGGLE,
COMMAND_TOGGLE,
SPLIT_VERTICALLY,
SPLIT_HORIZONTALLY,
MOVE_FOCUS,
Expand Down Expand Up @@ -297,7 +320,9 @@ pub fn resize_up_with_panes_below_aligned_right_with_current_pane() {
};
let mut fake_input_output = get_fake_os_input(&fake_win_size);

fake_input_output.add_terminal_input(&[COMMAND_TOGGLE, COMMAND_TOGGLE,
fake_input_output.add_terminal_input(&[
COMMAND_TOGGLE,
COMMAND_TOGGLE,
SPLIT_VERTICALLY,
SPLIT_HORIZONTALLY,
MOVE_FOCUS,
Expand Down Expand Up @@ -338,7 +363,9 @@ pub fn resize_up_with_panes_above_aligned_left_and_right_with_current_pane() {
};
let mut fake_input_output = get_fake_os_input(&fake_win_size);

fake_input_output.add_terminal_input(&[COMMAND_TOGGLE, COMMAND_TOGGLE,
fake_input_output.add_terminal_input(&[
COMMAND_TOGGLE,
COMMAND_TOGGLE,
SPLIT_VERTICALLY,
SPLIT_VERTICALLY,
SPLIT_HORIZONTALLY,
Expand Down Expand Up @@ -382,7 +409,9 @@ pub fn resize_up_with_panes_below_aligned_left_and_right_with_current_pane() {
};
let mut fake_input_output = get_fake_os_input(&fake_win_size);

fake_input_output.add_terminal_input(&[COMMAND_TOGGLE, COMMAND_TOGGLE,
fake_input_output.add_terminal_input(&[
COMMAND_TOGGLE,
COMMAND_TOGGLE,
SPLIT_VERTICALLY,
SPLIT_VERTICALLY,
SPLIT_HORIZONTALLY,
Expand Down Expand Up @@ -428,7 +457,9 @@ pub fn resize_up_with_panes_above_aligned_left_and_right_with_panes_to_the_left_
};
let mut fake_input_output = get_fake_os_input(&fake_win_size);

fake_input_output.add_terminal_input(&[COMMAND_TOGGLE, COMMAND_TOGGLE,
fake_input_output.add_terminal_input(&[
COMMAND_TOGGLE,
COMMAND_TOGGLE,
SPLIT_VERTICALLY,
SPLIT_VERTICALLY,
MOVE_FOCUS,
Expand Down Expand Up @@ -489,7 +520,9 @@ pub fn resize_up_with_panes_below_aligned_left_and_right_with_to_the_left_and_ri
};
let mut fake_input_output = get_fake_os_input(&fake_win_size);

fake_input_output.add_terminal_input(&[COMMAND_TOGGLE, COMMAND_TOGGLE,
fake_input_output.add_terminal_input(&[
COMMAND_TOGGLE,
COMMAND_TOGGLE,
SPLIT_VERTICALLY,
SPLIT_VERTICALLY,
MOVE_FOCUS,
Expand Down
2 changes: 1 addition & 1 deletion src/tests/integration/toggle_fullscreen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use crate::{start, Opt};

use crate::tests::utils::commands::{
CLOSE_FOCUSED_PANE, COMMAND_TOGGLE, MOVE_FOCUS, QUIT, SPLIT_HORIZONTALLY, SPLIT_VERTICALLY,
TOGGLE_ACTIVE_TERMINAL_FULLSCREEN
TOGGLE_ACTIVE_TERMINAL_FULLSCREEN,
};

fn get_fake_os_input(fake_win_size: &PositionAndSize) -> FakeInputOutput {
Expand Down