Move layout.rs from server to utils
* give feedback on most errors in the layout-file
This commit is contained in:
parent
9cbe410740
commit
cafcca0c57
28 changed files with 291 additions and 107 deletions
8
assets/layouts/disable-status-bar.yaml
Normal file
8
assets/layouts/disable-status-bar.yaml
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
---
|
||||||
|
direction: Horizontal
|
||||||
|
parts:
|
||||||
|
- direction: Vertical
|
||||||
|
split_size:
|
||||||
|
Fixed: 1
|
||||||
|
plugin: tab-bar
|
||||||
|
- direction: Vertical
|
||||||
|
|
@ -13,6 +13,7 @@ use zellij_utils::{
|
||||||
cli::{CliArgs, Command, Sessions},
|
cli::{CliArgs, Command, Sessions},
|
||||||
consts::{ZELLIJ_TMP_DIR, ZELLIJ_TMP_LOG_DIR},
|
consts::{ZELLIJ_TMP_DIR, ZELLIJ_TMP_LOG_DIR},
|
||||||
input::config::Config,
|
input::config::Config,
|
||||||
|
input::layout::Layout,
|
||||||
input::options::Options,
|
input::options::Options,
|
||||||
logging::*,
|
logging::*,
|
||||||
setup::{get_default_data_dir, Setup},
|
setup::{get_default_data_dir, Setup},
|
||||||
|
|
@ -72,6 +73,7 @@ pub fn main() {
|
||||||
opts,
|
opts,
|
||||||
config,
|
config,
|
||||||
ClientInfo::Attach(session_name.unwrap(), force, config_options),
|
ClientInfo::Attach(session_name.unwrap(), force, config_options),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
let session_name = opts
|
let session_name = opts
|
||||||
|
|
@ -85,11 +87,18 @@ pub fn main() {
|
||||||
#[cfg(not(disable_automatic_asset_installation))]
|
#[cfg(not(disable_automatic_asset_installation))]
|
||||||
populate_data_dir(&data_dir);
|
populate_data_dir(&data_dir);
|
||||||
|
|
||||||
|
let layout = Layout::from_path_or_default(
|
||||||
|
opts.layout.as_ref(),
|
||||||
|
opts.layout_path.as_ref(),
|
||||||
|
&data_dir,
|
||||||
|
);
|
||||||
|
|
||||||
start_client(
|
start_client(
|
||||||
Box::new(os_input),
|
Box::new(os_input),
|
||||||
opts,
|
opts,
|
||||||
config,
|
config,
|
||||||
ClientInfo::New(session_name),
|
ClientInfo::New(session_name),
|
||||||
|
layout,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
BIN
src/tests/fixtures/htop
vendored
BIN
src/tests/fixtures/htop
vendored
Binary file not shown.
|
|
@ -33,6 +33,7 @@ pub fn starts_with_one_terminal() {
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
.stdout_writer
|
.stdout_writer
|
||||||
|
|
@ -61,6 +62,7 @@ pub fn split_terminals_vertically() {
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
.stdout_writer
|
.stdout_writer
|
||||||
|
|
@ -89,6 +91,7 @@ pub fn split_terminals_horizontally() {
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
.stdout_writer
|
.stdout_writer
|
||||||
|
|
@ -124,6 +127,7 @@ pub fn split_largest_terminal() {
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
.stdout_writer
|
.stdout_writer
|
||||||
|
|
@ -152,6 +156,7 @@ pub fn cannot_split_terminals_vertically_when_active_terminal_is_too_small() {
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
.stdout_writer
|
.stdout_writer
|
||||||
|
|
@ -180,6 +185,7 @@ pub fn cannot_split_terminals_horizontally_when_active_terminal_is_too_small() {
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
.stdout_writer
|
.stdout_writer
|
||||||
|
|
@ -208,6 +214,7 @@ pub fn cannot_split_largest_terminal_when_there_is_no_room() {
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
.stdout_writer
|
.stdout_writer
|
||||||
|
|
@ -244,6 +251,7 @@ pub fn scrolling_up_inside_a_pane() {
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
.stdout_writer
|
.stdout_writer
|
||||||
|
|
@ -282,6 +290,7 @@ pub fn scrolling_down_inside_a_pane() {
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
.stdout_writer
|
.stdout_writer
|
||||||
|
|
@ -317,6 +326,7 @@ pub fn scrolling_page_up_inside_a_pane() {
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
.stdout_writer
|
.stdout_writer
|
||||||
|
|
@ -355,6 +365,7 @@ pub fn scrolling_page_down_inside_a_pane() {
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
.stdout_writer
|
.stdout_writer
|
||||||
|
|
@ -394,6 +405,7 @@ pub fn max_panes() {
|
||||||
opts,
|
opts,
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
.stdout_writer
|
.stdout_writer
|
||||||
|
|
@ -431,6 +443,7 @@ pub fn toggle_focused_pane_fullscreen() {
|
||||||
opts,
|
opts,
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
.stdout_writer
|
.stdout_writer
|
||||||
|
|
@ -471,6 +484,7 @@ pub fn bracketed_paste() {
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
.stdout_writer
|
.stdout_writer
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,7 @@ pub fn close_pane_with_another_pane_above_it() {
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
|
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
|
|
@ -89,6 +90,7 @@ pub fn close_pane_with_another_pane_below_it() {
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
|
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
|
|
@ -129,6 +131,7 @@ pub fn close_pane_with_another_pane_to_the_left() {
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
|
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
|
|
@ -170,6 +173,7 @@ pub fn close_pane_with_another_pane_to_the_right() {
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
|
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
|
|
@ -216,6 +220,7 @@ pub fn close_pane_with_multiple_panes_above_it() {
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
|
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
|
|
@ -260,6 +265,7 @@ pub fn close_pane_with_multiple_panes_below_it() {
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
|
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
|
|
@ -306,6 +312,7 @@ pub fn close_pane_with_multiple_panes_to_the_left() {
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
|
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
|
|
@ -350,6 +357,7 @@ pub fn close_pane_with_multiple_panes_to_the_right() {
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
|
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
|
|
@ -417,6 +425,7 @@ pub fn close_pane_with_multiple_panes_above_it_away_from_screen_edges() {
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
|
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
|
|
@ -480,6 +489,7 @@ pub fn close_pane_with_multiple_panes_below_it_away_from_screen_edges() {
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
|
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
|
|
@ -545,6 +555,7 @@ pub fn close_pane_with_multiple_panes_to_the_left_away_from_screen_edges() {
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
|
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
|
|
@ -610,6 +621,7 @@ pub fn close_pane_with_multiple_panes_to_the_right_away_from_screen_edges() {
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
|
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
|
|
@ -647,6 +659,7 @@ pub fn closing_last_pane_exits_app() {
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
|
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
|
|
|
||||||
|
|
@ -49,6 +49,7 @@ pub fn run_bandwhich_from_fish_shell() {
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
.stdout_writer
|
.stdout_writer
|
||||||
|
|
@ -78,6 +79,7 @@ pub fn fish_tab_completion_options() {
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
.stdout_writer
|
.stdout_writer
|
||||||
|
|
@ -112,6 +114,7 @@ pub fn fish_select_tab_completion_options() {
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
.stdout_writer
|
.stdout_writer
|
||||||
|
|
@ -150,6 +153,7 @@ pub fn vim_scroll_region_down() {
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
.stdout_writer
|
.stdout_writer
|
||||||
|
|
@ -185,6 +189,7 @@ pub fn vim_ctrl_d() {
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
.stdout_writer
|
.stdout_writer
|
||||||
|
|
@ -219,6 +224,7 @@ pub fn vim_ctrl_u() {
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
.stdout_writer
|
.stdout_writer
|
||||||
|
|
@ -248,6 +254,7 @@ pub fn htop() {
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
.stdout_writer
|
.stdout_writer
|
||||||
|
|
@ -277,6 +284,7 @@ pub fn htop_scrolling() {
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
.stdout_writer
|
.stdout_writer
|
||||||
|
|
@ -306,6 +314,7 @@ pub fn htop_right_scrolling() {
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
.stdout_writer
|
.stdout_writer
|
||||||
|
|
@ -343,6 +352,7 @@ pub fn vim_overwrite() {
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
.stdout_writer
|
.stdout_writer
|
||||||
|
|
@ -375,6 +385,7 @@ pub fn clear_scroll_region() {
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
.stdout_writer
|
.stdout_writer
|
||||||
|
|
@ -404,6 +415,7 @@ pub fn display_tab_characters_properly() {
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
.stdout_writer
|
.stdout_writer
|
||||||
|
|
@ -433,6 +445,7 @@ pub fn neovim_insert_mode() {
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
.stdout_writer
|
.stdout_writer
|
||||||
|
|
@ -464,6 +477,7 @@ pub fn bash_cursor_linewrap() {
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
.stdout_writer
|
.stdout_writer
|
||||||
|
|
@ -495,6 +509,7 @@ pub fn fish_paste_multiline() {
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
.stdout_writer
|
.stdout_writer
|
||||||
|
|
@ -524,6 +539,7 @@ pub fn git_log() {
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
.stdout_writer
|
.stdout_writer
|
||||||
|
|
@ -555,6 +571,7 @@ pub fn git_diff_scrollup() {
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
.stdout_writer
|
.stdout_writer
|
||||||
|
|
@ -584,6 +601,7 @@ pub fn emacs_longbuf() {
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
.stdout_writer
|
.stdout_writer
|
||||||
|
|
@ -613,6 +631,7 @@ pub fn top_and_quit() {
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
.stdout_writer
|
.stdout_writer
|
||||||
|
|
@ -648,6 +667,7 @@ pub fn exa_plus_omf_theme() {
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
.stdout_writer
|
.stdout_writer
|
||||||
|
|
|
||||||
|
|
@ -29,11 +29,18 @@ pub fn accepts_basic_layout() {
|
||||||
"src/tests/fixtures/layouts/three-panes-with-nesting.yaml",
|
"src/tests/fixtures/layouts/three-panes-with-nesting.yaml",
|
||||||
));
|
));
|
||||||
|
|
||||||
|
let layout = zellij_utils::input::layout::Layout::from_path_or_default(
|
||||||
|
None,
|
||||||
|
opts.layout_path.as_ref(),
|
||||||
|
std::path::Path::new("unused"),
|
||||||
|
);
|
||||||
|
|
||||||
start(
|
start(
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
opts,
|
opts,
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
layout,
|
||||||
);
|
);
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
.stdout_writer
|
.stdout_writer
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,7 @@ pub fn move_focus_down() {
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
|
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
|
|
@ -75,6 +76,7 @@ pub fn move_focus_down_to_the_most_recently_used_pane() {
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
|
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,7 @@ pub fn move_focus_left() {
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
|
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
|
|
@ -76,6 +77,7 @@ pub fn move_focus_left_to_the_most_recently_used_pane() {
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
|
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
|
|
@ -114,6 +116,7 @@ pub fn move_focus_left_changes_tab() {
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
|
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,7 @@ pub fn move_focus_right() {
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
|
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
|
|
@ -76,6 +77,7 @@ pub fn move_focus_right_to_the_most_recently_used_pane() {
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
|
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
|
|
@ -114,6 +116,7 @@ pub fn move_focus_right_changes_tab() {
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
|
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,7 @@ pub fn move_focus_up() {
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
|
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
|
|
@ -75,6 +76,7 @@ pub fn move_focus_up_to_the_most_recently_used_pane() {
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
|
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
|
|
|
||||||
|
|
@ -49,6 +49,7 @@ pub fn resize_down_with_pane_above() {
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
|
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
|
|
@ -94,6 +95,7 @@ pub fn resize_down_with_pane_below() {
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
|
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
|
|
@ -145,6 +147,7 @@ pub fn resize_down_with_panes_above_and_below() {
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
|
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
|
|
@ -195,6 +198,7 @@ pub fn resize_down_with_multiple_panes_above() {
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
|
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
|
|
@ -247,6 +251,7 @@ pub fn resize_down_with_panes_above_aligned_left_with_current_pane() {
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
|
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
|
|
@ -298,6 +303,7 @@ pub fn resize_down_with_panes_below_aligned_left_with_current_pane() {
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
|
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
|
|
@ -347,6 +353,7 @@ pub fn resize_down_with_panes_above_aligned_right_with_current_pane() {
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
|
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
|
|
@ -397,6 +404,7 @@ pub fn resize_down_with_panes_below_aligned_right_with_current_pane() {
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
|
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
|
|
@ -451,6 +459,7 @@ pub fn resize_down_with_panes_above_aligned_left_and_right_with_current_pane() {
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
|
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
|
|
@ -507,6 +516,7 @@ pub fn resize_down_with_panes_below_aligned_left_and_right_with_current_pane() {
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
|
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
|
|
@ -581,6 +591,7 @@ pub fn resize_down_with_panes_above_aligned_left_and_right_with_panes_to_the_lef
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
|
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
|
|
@ -656,6 +667,7 @@ pub fn resize_down_with_panes_below_aligned_left_and_right_with_to_the_left_and_
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
|
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
|
|
@ -698,6 +710,7 @@ pub fn cannot_resize_down_when_pane_below_is_at_minimum_height() {
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
|
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
|
|
|
||||||
|
|
@ -45,6 +45,7 @@ pub fn resize_left_with_pane_to_the_left() {
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
|
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
|
|
@ -88,6 +89,7 @@ pub fn resize_left_with_pane_to_the_right() {
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
|
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
|
|
@ -133,6 +135,7 @@ pub fn resize_left_with_panes_to_the_left_and_right() {
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
|
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
|
|
@ -181,6 +184,7 @@ pub fn resize_left_with_multiple_panes_to_the_left() {
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
|
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
|
|
@ -231,6 +235,7 @@ pub fn resize_left_with_panes_to_the_left_aligned_top_with_current_pane() {
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
|
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
|
|
@ -278,6 +283,7 @@ pub fn resize_left_with_panes_to_the_right_aligned_top_with_current_pane() {
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
|
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
|
|
@ -327,6 +333,7 @@ pub fn resize_left_with_panes_to_the_left_aligned_bottom_with_current_pane() {
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
|
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
|
|
@ -375,6 +382,7 @@ pub fn resize_left_with_panes_to_the_right_aligned_bottom_with_current_pane() {
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
|
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
|
|
@ -429,6 +437,7 @@ pub fn resize_left_with_panes_to_the_left_aligned_top_and_bottom_with_current_pa
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
|
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
|
|
@ -485,6 +494,7 @@ pub fn resize_left_with_panes_to_the_right_aligned_top_and_bottom_with_current_p
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
|
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
|
|
@ -558,6 +568,7 @@ pub fn resize_left_with_panes_to_the_left_aligned_top_and_bottom_with_panes_abov
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
|
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
|
|
@ -633,6 +644,7 @@ pub fn resize_left_with_panes_to_the_right_aligned_top_and_bottom_with_panes_abo
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
|
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
|
|
@ -675,6 +687,7 @@ pub fn cannot_resize_left_when_pane_to_the_left_is_at_minimum_width() {
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
|
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
|
|
|
||||||
|
|
@ -45,6 +45,7 @@ pub fn resize_right_with_pane_to_the_left() {
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
|
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
|
|
@ -88,6 +89,7 @@ pub fn resize_right_with_pane_to_the_right() {
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
|
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
|
|
@ -133,6 +135,7 @@ pub fn resize_right_with_panes_to_the_left_and_right() {
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
|
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
|
|
@ -181,6 +184,7 @@ pub fn resize_right_with_multiple_panes_to_the_left() {
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
|
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
|
|
@ -231,6 +235,7 @@ pub fn resize_right_with_panes_to_the_left_aligned_top_with_current_pane() {
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
|
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
|
|
@ -278,6 +283,7 @@ pub fn resize_right_with_panes_to_the_right_aligned_top_with_current_pane() {
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
|
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
|
|
@ -327,6 +333,7 @@ pub fn resize_right_with_panes_to_the_left_aligned_bottom_with_current_pane() {
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
|
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
|
|
@ -375,6 +382,7 @@ pub fn resize_right_with_panes_to_the_right_aligned_bottom_with_current_pane() {
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
|
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
|
|
@ -429,6 +437,7 @@ pub fn resize_right_with_panes_to_the_left_aligned_top_and_bottom_with_current_p
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
|
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
|
|
@ -485,6 +494,7 @@ pub fn resize_right_with_panes_to_the_right_aligned_top_and_bottom_with_current_
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
|
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
|
|
@ -558,6 +568,7 @@ pub fn resize_right_with_panes_to_the_left_aligned_top_and_bottom_with_panes_abo
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
|
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
|
|
@ -632,6 +643,7 @@ pub fn resize_right_with_panes_to_the_right_aligned_top_and_bottom_with_panes_ab
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
|
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
|
|
@ -674,6 +686,7 @@ pub fn cannot_resize_right_when_pane_to_the_left_is_at_minimum_width() {
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
|
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
|
|
|
||||||
|
|
@ -47,6 +47,7 @@ pub fn resize_up_with_pane_above() {
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
|
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
|
|
@ -92,6 +93,7 @@ pub fn resize_up_with_pane_below() {
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
|
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
|
|
@ -142,6 +144,7 @@ pub fn resize_up_with_panes_above_and_below() {
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
|
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
|
|
@ -191,6 +194,7 @@ pub fn resize_up_with_multiple_panes_above() {
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
|
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
|
|
@ -241,6 +245,7 @@ pub fn resize_up_with_panes_above_aligned_left_with_current_pane() {
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
|
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
|
|
@ -292,6 +297,7 @@ pub fn resize_up_with_panes_below_aligned_left_with_current_pane() {
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
|
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
|
|
@ -341,6 +347,7 @@ pub fn resize_up_with_panes_above_aligned_right_with_current_pane() {
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
|
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
|
|
@ -391,6 +398,7 @@ pub fn resize_up_with_panes_below_aligned_right_with_current_pane() {
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
|
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
|
|
@ -445,6 +453,7 @@ pub fn resize_up_with_panes_above_aligned_left_and_right_with_current_pane() {
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
|
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
|
|
@ -501,6 +510,7 @@ pub fn resize_up_with_panes_below_aligned_left_and_right_with_current_pane() {
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
|
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
|
|
@ -575,6 +585,7 @@ pub fn resize_up_with_panes_above_aligned_left_and_right_with_panes_to_the_left_
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
|
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
|
|
@ -650,6 +661,7 @@ pub fn resize_up_with_panes_below_aligned_left_and_right_with_to_the_left_and_ri
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
|
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
|
|
@ -692,6 +704,7 @@ pub fn cannot_resize_up_when_pane_above_is_at_minimum_height() {
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
|
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,7 @@ pub fn open_new_tab() {
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
|
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
|
|
@ -76,6 +77,7 @@ pub fn switch_to_prev_tab() {
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
|
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
|
|
@ -112,6 +114,7 @@ pub fn switch_to_next_tab() {
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
|
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
|
|
@ -148,6 +151,7 @@ pub fn close_tab() {
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
|
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
|
|
@ -185,6 +189,7 @@ pub fn close_last_pane_in_a_tab() {
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
|
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
|
|
@ -224,6 +229,7 @@ pub fn close_the_middle_tab() {
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
|
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
|
|
@ -268,6 +274,7 @@ pub fn close_the_tab_that_has_a_pane_in_fullscreen() {
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
|
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
|
|
@ -304,6 +311,7 @@ pub fn closing_last_tab_exits_the_app() {
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
|
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,7 @@ pub fn window_width_decrease_with_one_pane() {
|
||||||
opts,
|
opts,
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
.stdout_writer
|
.stdout_writer
|
||||||
|
|
@ -72,6 +73,7 @@ pub fn window_width_increase_with_one_pane() {
|
||||||
opts,
|
opts,
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
.stdout_writer
|
.stdout_writer
|
||||||
|
|
@ -108,6 +110,7 @@ pub fn window_height_increase_with_one_pane() {
|
||||||
opts,
|
opts,
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
.stdout_writer
|
.stdout_writer
|
||||||
|
|
@ -144,6 +147,7 @@ pub fn window_width_and_height_decrease_with_one_pane() {
|
||||||
opts,
|
opts,
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
.stdout_writer
|
.stdout_writer
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,7 @@ pub fn adding_new_terminal_in_fullscreen() {
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
|
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
|
|
@ -73,6 +74,7 @@ pub fn move_focus_is_disabled_in_fullscreen() {
|
||||||
CliArgs::default(),
|
CliArgs::default(),
|
||||||
Box::new(fake_input_output.clone()),
|
Box::new(fake_input_output.clone()),
|
||||||
Config::default(),
|
Config::default(),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
|
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
|
|
|
||||||
|
|
@ -7,13 +7,17 @@ pub mod utils;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use zellij_client::{os_input_output::ClientOsApi, start_client, ClientInfo};
|
use zellij_client::{os_input_output::ClientOsApi, start_client, ClientInfo};
|
||||||
use zellij_server::{os_input_output::ServerOsApi, start_server};
|
use zellij_server::{os_input_output::ServerOsApi, start_server};
|
||||||
use zellij_utils::{cli::CliArgs, input::config::Config};
|
use zellij_utils::{
|
||||||
|
cli::CliArgs,
|
||||||
|
input::{config::Config, layout::Layout},
|
||||||
|
};
|
||||||
|
|
||||||
pub fn start(
|
pub fn start(
|
||||||
client_os_input: Box<dyn ClientOsApi>,
|
client_os_input: Box<dyn ClientOsApi>,
|
||||||
opts: CliArgs,
|
opts: CliArgs,
|
||||||
server_os_input: Box<dyn ServerOsApi>,
|
server_os_input: Box<dyn ServerOsApi>,
|
||||||
config: Config,
|
config: Config,
|
||||||
|
layout: Option<Layout>,
|
||||||
) {
|
) {
|
||||||
let server_thread = std::thread::Builder::new()
|
let server_thread = std::thread::Builder::new()
|
||||||
.name("server_thread".into())
|
.name("server_thread".into())
|
||||||
|
|
@ -21,6 +25,12 @@ pub fn start(
|
||||||
start_server(server_os_input, PathBuf::from(""));
|
start_server(server_os_input, PathBuf::from(""));
|
||||||
})
|
})
|
||||||
.unwrap();
|
.unwrap();
|
||||||
start_client(client_os_input, opts, config, ClientInfo::New("".into()));
|
start_client(
|
||||||
|
client_os_input,
|
||||||
|
opts,
|
||||||
|
config,
|
||||||
|
ClientInfo::New("".into()),
|
||||||
|
layout,
|
||||||
|
);
|
||||||
let _ = server_thread.join();
|
let _ = server_thread.join();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ use zellij_utils::{
|
||||||
channels::{self, ChannelWithContext, SenderWithContext},
|
channels::{self, ChannelWithContext, SenderWithContext},
|
||||||
consts::{SESSION_NAME, ZELLIJ_IPC_PIPE},
|
consts::{SESSION_NAME, ZELLIJ_IPC_PIPE},
|
||||||
errors::{ClientContext, ContextType, ErrorInstruction},
|
errors::{ClientContext, ContextType, ErrorInstruction},
|
||||||
input::{actions::Action, config::Config, options::Options},
|
input::{actions::Action, config::Config, layout::Layout, options::Options},
|
||||||
ipc::{ClientAttributes, ClientToServerMsg, ExitReason, ServerToClientMsg},
|
ipc::{ClientAttributes, ClientToServerMsg, ExitReason, ServerToClientMsg},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -86,19 +86,13 @@ pub fn start_client(
|
||||||
opts: CliArgs,
|
opts: CliArgs,
|
||||||
config: Config,
|
config: Config,
|
||||||
info: ClientInfo,
|
info: ClientInfo,
|
||||||
|
layout: Option<Layout>,
|
||||||
) {
|
) {
|
||||||
let clear_client_terminal_attributes = "\u{1b}[?1l\u{1b}=\u{1b}[r\u{1b}12l\u{1b}[?1000l\u{1b}[?1002l\u{1b}[?1003l\u{1b}[?1005l\u{1b}[?1006l\u{1b}[?12l";
|
let clear_client_terminal_attributes = "\u{1b}[?1l\u{1b}=\u{1b}[r\u{1b}12l\u{1b}[?1000l\u{1b}[?1002l\u{1b}[?1003l\u{1b}[?1005l\u{1b}[?1006l\u{1b}[?12l";
|
||||||
let take_snapshot = "\u{1b}[?1049h";
|
let take_snapshot = "\u{1b}[?1049h";
|
||||||
let bracketed_paste = "\u{1b}[?2004h";
|
let bracketed_paste = "\u{1b}[?2004h";
|
||||||
os_input.unset_raw_mode(0);
|
os_input.unset_raw_mode(0);
|
||||||
let config_options = Options::from_cli(&config.options, opts.command.clone());
|
|
||||||
let palette = config.themes.clone().map_or_else(
|
|
||||||
|| os_input.load_palette(),
|
|
||||||
|t| {
|
|
||||||
t.theme_config(&config_options)
|
|
||||||
.unwrap_or_else(|| os_input.load_palette())
|
|
||||||
},
|
|
||||||
);
|
|
||||||
let _ = os_input
|
let _ = os_input
|
||||||
.get_stdout_writer()
|
.get_stdout_writer()
|
||||||
.write(take_snapshot.as_bytes())
|
.write(take_snapshot.as_bytes())
|
||||||
|
|
@ -109,6 +103,15 @@ pub fn start_client(
|
||||||
.unwrap();
|
.unwrap();
|
||||||
std::env::set_var(&"ZELLIJ", "0");
|
std::env::set_var(&"ZELLIJ", "0");
|
||||||
|
|
||||||
|
let config_options = Options::from_cli(&config.options, opts.command.clone());
|
||||||
|
let palette = config.themes.clone().map_or_else(
|
||||||
|
|| os_input.load_palette(),
|
||||||
|
|t| {
|
||||||
|
t.theme_config(&config_options)
|
||||||
|
.unwrap_or_else(|| os_input.load_palette())
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
let full_screen_ws = os_input.get_terminal_size_using_fd(0);
|
let full_screen_ws = os_input.get_terminal_size_using_fd(0);
|
||||||
let client_attributes = ClientAttributes {
|
let client_attributes = ClientAttributes {
|
||||||
position_and_size: full_screen_ws,
|
position_and_size: full_screen_ws,
|
||||||
|
|
@ -133,6 +136,7 @@ pub fn start_client(
|
||||||
client_attributes,
|
client_attributes,
|
||||||
Box::new(opts),
|
Box::new(opts),
|
||||||
Box::new(config_options.clone()),
|
Box::new(config_options.clone()),
|
||||||
|
layout,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
@ -143,6 +147,7 @@ pub fn start_client(
|
||||||
client_attributes,
|
client_attributes,
|
||||||
Box::new(opts),
|
Box::new(opts),
|
||||||
Box::new(config_options.clone()),
|
Box::new(config_options.clone()),
|
||||||
|
layout,
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,6 @@ use crate::{
|
||||||
pty::{pty_thread_main, Pty, PtyInstruction},
|
pty::{pty_thread_main, Pty, PtyInstruction},
|
||||||
screen::{screen_thread_main, ScreenInstruction},
|
screen::{screen_thread_main, ScreenInstruction},
|
||||||
thread_bus::{Bus, ThreadSenders},
|
thread_bus::{Bus, ThreadSenders},
|
||||||
ui::layout::Layout,
|
|
||||||
wasm_vm::{wasm_thread_main, PluginInstruction},
|
wasm_vm::{wasm_thread_main, PluginInstruction},
|
||||||
};
|
};
|
||||||
use route::route_thread_main;
|
use route::route_thread_main;
|
||||||
|
|
@ -30,7 +29,7 @@ use zellij_utils::{
|
||||||
channels::{self, ChannelWithContext, SenderWithContext},
|
channels::{self, ChannelWithContext, SenderWithContext},
|
||||||
cli::CliArgs,
|
cli::CliArgs,
|
||||||
errors::{ContextType, ErrorInstruction, ServerContext},
|
errors::{ContextType, ErrorInstruction, ServerContext},
|
||||||
input::{get_mode_info, options::Options},
|
input::{get_mode_info, layout::Layout, options::Options},
|
||||||
ipc::{ClientAttributes, ClientToServerMsg, ExitReason, ServerToClientMsg},
|
ipc::{ClientAttributes, ClientToServerMsg, ExitReason, ServerToClientMsg},
|
||||||
setup::get_default_data_dir,
|
setup::get_default_data_dir,
|
||||||
};
|
};
|
||||||
|
|
@ -38,7 +37,7 @@ use zellij_utils::{
|
||||||
/// Instructions related to server-side application
|
/// Instructions related to server-side application
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub(crate) enum ServerInstruction {
|
pub(crate) enum ServerInstruction {
|
||||||
NewClient(ClientAttributes, Box<CliArgs>, Box<Options>),
|
NewClient(ClientAttributes, Box<CliArgs>, Box<Options>, Option<Layout>),
|
||||||
Render(Option<String>),
|
Render(Option<String>),
|
||||||
UnblockInputThread,
|
UnblockInputThread,
|
||||||
ClientExit,
|
ClientExit,
|
||||||
|
|
@ -50,8 +49,8 @@ pub(crate) enum ServerInstruction {
|
||||||
impl From<ClientToServerMsg> for ServerInstruction {
|
impl From<ClientToServerMsg> for ServerInstruction {
|
||||||
fn from(instruction: ClientToServerMsg) -> Self {
|
fn from(instruction: ClientToServerMsg) -> Self {
|
||||||
match instruction {
|
match instruction {
|
||||||
ClientToServerMsg::NewClient(attrs, opts, options) => {
|
ClientToServerMsg::NewClient(attrs, opts, options, layout) => {
|
||||||
ServerInstruction::NewClient(attrs, opts, options)
|
ServerInstruction::NewClient(attrs, opts, options, layout)
|
||||||
}
|
}
|
||||||
ClientToServerMsg::AttachClient(attrs, force, options) => {
|
ClientToServerMsg::AttachClient(attrs, force, options) => {
|
||||||
ServerInstruction::AttachClient(attrs, force, options)
|
ServerInstruction::AttachClient(attrs, force, options)
|
||||||
|
|
@ -206,7 +205,7 @@ pub fn start_server(os_input: Box<dyn ServerOsApi>, socket_path: PathBuf) {
|
||||||
let (instruction, mut err_ctx) = server_receiver.recv().unwrap();
|
let (instruction, mut err_ctx) = server_receiver.recv().unwrap();
|
||||||
err_ctx.add_call(ContextType::IPCServer((&instruction).into()));
|
err_ctx.add_call(ContextType::IPCServer((&instruction).into()));
|
||||||
match instruction {
|
match instruction {
|
||||||
ServerInstruction::NewClient(client_attributes, opts, config_options) => {
|
ServerInstruction::NewClient(client_attributes, opts, config_options, layout) => {
|
||||||
let session = init_session(
|
let session = init_session(
|
||||||
os_input.clone(),
|
os_input.clone(),
|
||||||
opts,
|
opts,
|
||||||
|
|
@ -214,6 +213,7 @@ pub fn start_server(os_input: Box<dyn ServerOsApi>, socket_path: PathBuf) {
|
||||||
to_server.clone(),
|
to_server.clone(),
|
||||||
client_attributes,
|
client_attributes,
|
||||||
session_state.clone(),
|
session_state.clone(),
|
||||||
|
layout,
|
||||||
);
|
);
|
||||||
*session_data.write().unwrap() = Some(session);
|
*session_data.write().unwrap() = Some(session);
|
||||||
*session_state.write().unwrap() = SessionState::Attached;
|
*session_state.write().unwrap() = SessionState::Attached;
|
||||||
|
|
@ -301,6 +301,7 @@ fn init_session(
|
||||||
to_server: SenderWithContext<ServerInstruction>,
|
to_server: SenderWithContext<ServerInstruction>,
|
||||||
client_attributes: ClientAttributes,
|
client_attributes: ClientAttributes,
|
||||||
session_state: Arc<RwLock<SessionState>>,
|
session_state: Arc<RwLock<SessionState>>,
|
||||||
|
layout: Option<Layout>,
|
||||||
) -> SessionMetaData {
|
) -> SessionMetaData {
|
||||||
let (to_screen, screen_receiver): ChannelWithContext<ScreenInstruction> = channels::unbounded();
|
let (to_screen, screen_receiver): ChannelWithContext<ScreenInstruction> = channels::unbounded();
|
||||||
let to_screen = SenderWithContext::new(to_screen);
|
let to_screen = SenderWithContext::new(to_screen);
|
||||||
|
|
@ -321,19 +322,6 @@ fn init_session(
|
||||||
arrow_fonts: config_options.simplified_ui,
|
arrow_fonts: config_options.simplified_ui,
|
||||||
};
|
};
|
||||||
|
|
||||||
// Don't use default layouts in tests, but do everywhere else
|
|
||||||
#[cfg(not(any(feature = "test", test)))]
|
|
||||||
let default_layout = Some(PathBuf::from("default"));
|
|
||||||
#[cfg(any(feature = "test", test))]
|
|
||||||
let default_layout = None;
|
|
||||||
let layout_path = opts.layout_path;
|
|
||||||
let maybe_layout = opts
|
|
||||||
.layout
|
|
||||||
.as_ref()
|
|
||||||
.map(|p| Layout::from_dir(&p, &data_dir))
|
|
||||||
.or_else(|| layout_path.map(|p| Layout::new(&p)))
|
|
||||||
.or_else(|| default_layout.map(|p| Layout::from_dir(&p, &data_dir)));
|
|
||||||
|
|
||||||
let pty_thread = thread::Builder::new()
|
let pty_thread = thread::Builder::new()
|
||||||
.name("pty".to_string())
|
.name("pty".to_string())
|
||||||
.spawn({
|
.spawn({
|
||||||
|
|
@ -349,7 +337,7 @@ fn init_session(
|
||||||
opts.debug,
|
opts.debug,
|
||||||
);
|
);
|
||||||
|
|
||||||
move || pty_thread_main(pty, maybe_layout)
|
move || pty_thread_main(pty, layout)
|
||||||
})
|
})
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,12 +12,12 @@ use crate::{
|
||||||
panes::PaneId,
|
panes::PaneId,
|
||||||
screen::ScreenInstruction,
|
screen::ScreenInstruction,
|
||||||
thread_bus::{Bus, ThreadSenders},
|
thread_bus::{Bus, ThreadSenders},
|
||||||
ui::layout::Layout,
|
|
||||||
wasm_vm::PluginInstruction,
|
wasm_vm::PluginInstruction,
|
||||||
ServerInstruction,
|
ServerInstruction,
|
||||||
};
|
};
|
||||||
use zellij_utils::{
|
use zellij_utils::{
|
||||||
errors::{get_current_ctx, ContextType, PtyContext},
|
errors::{get_current_ctx, ContextType, PtyContext},
|
||||||
|
input::layout::Layout,
|
||||||
logging::debug_to_file,
|
logging::debug_to_file,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,14 +5,13 @@ use std::os::unix::io::RawFd;
|
||||||
use std::str;
|
use std::str;
|
||||||
use std::sync::{Arc, RwLock};
|
use std::sync::{Arc, RwLock};
|
||||||
|
|
||||||
use zellij_utils::zellij_tile;
|
use zellij_utils::{input::layout::Layout, zellij_tile};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
panes::PaneId,
|
panes::PaneId,
|
||||||
pty::{PtyInstruction, VteBytes},
|
pty::{PtyInstruction, VteBytes},
|
||||||
tab::Tab,
|
tab::Tab,
|
||||||
thread_bus::Bus,
|
thread_bus::Bus,
|
||||||
ui::layout::Layout,
|
|
||||||
wasm_vm::PluginInstruction,
|
wasm_vm::PluginInstruction,
|
||||||
ServerInstruction, SessionState,
|
ServerInstruction, SessionState,
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ use crate::{
|
||||||
panes::{PaneId, PluginPane, TerminalPane},
|
panes::{PaneId, PluginPane, TerminalPane},
|
||||||
pty::{PtyInstruction, VteBytes},
|
pty::{PtyInstruction, VteBytes},
|
||||||
thread_bus::ThreadSenders,
|
thread_bus::ThreadSenders,
|
||||||
ui::{boundaries::Boundaries, layout::Layout, pane_resizer::PaneResizer},
|
ui::{boundaries::Boundaries, pane_resizer::PaneResizer},
|
||||||
wasm_vm::PluginInstruction,
|
wasm_vm::PluginInstruction,
|
||||||
ServerInstruction, SessionState,
|
ServerInstruction, SessionState,
|
||||||
};
|
};
|
||||||
|
|
@ -21,7 +21,11 @@ use std::{
|
||||||
collections::{BTreeMap, HashSet},
|
collections::{BTreeMap, HashSet},
|
||||||
};
|
};
|
||||||
use zellij_tile::data::{Event, InputMode, ModeInfo, Palette};
|
use zellij_tile::data::{Event, InputMode, ModeInfo, Palette};
|
||||||
use zellij_utils::{input::parse_keys, pane_size::PositionAndSize, shared::adjust_to_size};
|
use zellij_utils::{
|
||||||
|
input::{layout::Layout, parse_keys},
|
||||||
|
pane_size::PositionAndSize,
|
||||||
|
shared::adjust_to_size,
|
||||||
|
};
|
||||||
|
|
||||||
const CURSOR_HEIGHT_WIDTH_RATIO: usize = 4; // this is not accurate and kind of a magic number, TODO: look into this
|
const CURSOR_HEIGHT_WIDTH_RATIO: usize = 4; // this is not accurate and kind of a magic number, TODO: look into this
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,2 @@
|
||||||
pub mod boundaries;
|
pub mod boundaries;
|
||||||
pub mod layout;
|
|
||||||
pub mod pane_resizer;
|
pub mod pane_resizer;
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,107 @@
|
||||||
use zellij_utils::{serde, serde_yaml};
|
//! The layout system.
|
||||||
|
// Layouts have been moved from [`zellij-server`] to
|
||||||
|
// [`zellij-utils`] in order to provide more helpful
|
||||||
|
// error messages to the user until a more general
|
||||||
|
// logging system is in place.
|
||||||
|
// In case there is a logging system in place evaluate,
|
||||||
|
// if [`zellij-utils`], or [`zellij-server`] is a proper
|
||||||
|
// place.
|
||||||
|
// If plugins should be able to depend on the layout system
|
||||||
|
// then [`zellij-utils`] could be a proper place.
|
||||||
|
use crate::{input::config::ConfigError, pane_size::PositionAndSize};
|
||||||
|
use crate::{serde, serde_yaml};
|
||||||
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
use std::{fs::File, io::prelude::*};
|
use std::{fs::File, io::prelude::*};
|
||||||
|
|
||||||
use zellij_utils::pane_size::PositionAndSize;
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
|
#[serde(crate = "self::serde")]
|
||||||
|
pub enum Direction {
|
||||||
|
Horizontal,
|
||||||
|
Vertical,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone, Copy)]
|
||||||
|
#[serde(crate = "self::serde")]
|
||||||
|
pub enum SplitSize {
|
||||||
|
Percent(u8), // 1 to 100
|
||||||
|
Fixed(u16), // An absolute number of columns or rows
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
|
#[serde(crate = "self::serde")]
|
||||||
|
pub struct Layout {
|
||||||
|
pub direction: Direction,
|
||||||
|
#[serde(default)]
|
||||||
|
pub parts: Vec<Layout>,
|
||||||
|
pub split_size: Option<SplitSize>,
|
||||||
|
pub plugin: Option<PathBuf>,
|
||||||
|
}
|
||||||
|
|
||||||
|
type LayoutResult = Result<Layout, ConfigError>;
|
||||||
|
|
||||||
|
impl Layout {
|
||||||
|
pub fn new(layout_path: &Path) -> LayoutResult {
|
||||||
|
let mut layout_file = File::open(&layout_path)
|
||||||
|
.or_else(|_| File::open(&layout_path.with_extension("yaml")))
|
||||||
|
.map_err(|e| ConfigError::IoPath(e, layout_path.into()))?;
|
||||||
|
|
||||||
|
let mut layout = String::new();
|
||||||
|
layout_file.read_to_string(&mut layout)?;
|
||||||
|
let layout: Layout = serde_yaml::from_str(&layout)?;
|
||||||
|
Ok(layout)
|
||||||
|
}
|
||||||
|
|
||||||
|
// It wants to use Path here, but that doesn't compile.
|
||||||
|
#[allow(clippy::ptr_arg)]
|
||||||
|
pub fn from_dir(layout: &PathBuf, data_dir: &Path) -> LayoutResult {
|
||||||
|
Self::new(&data_dir.join("layouts/").join(layout))
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn from_path_or_default(
|
||||||
|
layout: Option<&PathBuf>,
|
||||||
|
layout_path: Option<&PathBuf>,
|
||||||
|
data_dir: &Path,
|
||||||
|
) -> Option<Layout> {
|
||||||
|
let layout_result = layout
|
||||||
|
.map(|p| Layout::from_dir(&p, &data_dir))
|
||||||
|
.or_else(|| layout_path.map(|p| Layout::new(&p)))
|
||||||
|
.or_else(|| {
|
||||||
|
Some(Layout::from_dir(
|
||||||
|
&std::path::PathBuf::from("default"),
|
||||||
|
&data_dir,
|
||||||
|
))
|
||||||
|
});
|
||||||
|
|
||||||
|
match layout_result {
|
||||||
|
None => None,
|
||||||
|
Some(Ok(layout)) => Some(layout),
|
||||||
|
Some(Err(e)) => {
|
||||||
|
eprintln!("There was an error in the layout file:\n{}", e);
|
||||||
|
std::process::exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn total_terminal_panes(&self) -> usize {
|
||||||
|
let mut total_panes = 0;
|
||||||
|
total_panes += self.parts.len();
|
||||||
|
for part in self.parts.iter() {
|
||||||
|
if part.plugin.is_none() {
|
||||||
|
total_panes += part.total_terminal_panes();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
total_panes
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn position_panes_in_space(
|
||||||
|
&self,
|
||||||
|
space: &PositionAndSize,
|
||||||
|
) -> Vec<(Layout, PositionAndSize)> {
|
||||||
|
split_space(space, &self)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fn split_space_to_parts_vertically(
|
fn split_space_to_parts_vertically(
|
||||||
space_to_split: &PositionAndSize,
|
space_to_split: &PositionAndSize,
|
||||||
|
|
@ -167,69 +264,3 @@ fn split_space(
|
||||||
}
|
}
|
||||||
pane_positions
|
pane_positions
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
|
||||||
#[serde(crate = "self::serde")]
|
|
||||||
pub(crate) enum Direction {
|
|
||||||
Horizontal,
|
|
||||||
Vertical,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, Copy)]
|
|
||||||
#[serde(crate = "self::serde")]
|
|
||||||
pub(crate) enum SplitSize {
|
|
||||||
Percent(u8), // 1 to 100
|
|
||||||
Fixed(u16), // An absolute number of columns or rows
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
|
||||||
#[serde(crate = "self::serde")]
|
|
||||||
pub(crate) struct Layout {
|
|
||||||
pub direction: Direction,
|
|
||||||
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
|
||||||
pub parts: Vec<Layout>,
|
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
|
||||||
pub split_size: Option<SplitSize>,
|
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
|
||||||
pub plugin: Option<PathBuf>,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Layout {
|
|
||||||
pub fn new(layout_path: &Path) -> Self {
|
|
||||||
let mut layout_file = File::open(&layout_path)
|
|
||||||
.or_else(|_| File::open(&layout_path.with_extension("yaml")))
|
|
||||||
.unwrap_or_else(|_| panic!("cannot find layout {}", &layout_path.display()));
|
|
||||||
|
|
||||||
let mut layout = String::new();
|
|
||||||
layout_file
|
|
||||||
.read_to_string(&mut layout)
|
|
||||||
.unwrap_or_else(|_| panic!("could not read layout {}", &layout_path.display()));
|
|
||||||
let layout: Layout = serde_yaml::from_str(&layout)
|
|
||||||
.unwrap_or_else(|_| panic!("could not parse layout {}", &layout_path.display()));
|
|
||||||
layout
|
|
||||||
}
|
|
||||||
|
|
||||||
// It wants to use Path here, but that doesn't compile.
|
|
||||||
#[allow(clippy::ptr_arg)]
|
|
||||||
pub fn from_dir(layout: &PathBuf, data_dir: &Path) -> Self {
|
|
||||||
Self::new(&data_dir.join("layouts/").join(layout))
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn total_terminal_panes(&self) -> usize {
|
|
||||||
let mut total_panes = 0;
|
|
||||||
total_panes += self.parts.len();
|
|
||||||
for part in self.parts.iter() {
|
|
||||||
if part.plugin.is_none() {
|
|
||||||
total_panes += part.total_terminal_panes();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
total_panes
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn position_panes_in_space(
|
|
||||||
&self,
|
|
||||||
space: &PositionAndSize,
|
|
||||||
) -> Vec<(Layout, PositionAndSize)> {
|
|
||||||
split_space(space, &self)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -3,6 +3,7 @@
|
||||||
pub mod actions;
|
pub mod actions;
|
||||||
pub mod config;
|
pub mod config;
|
||||||
pub mod keybinds;
|
pub mod keybinds;
|
||||||
|
pub mod layout;
|
||||||
pub mod options;
|
pub mod options;
|
||||||
pub mod theme;
|
pub mod theme;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ use crate::cli::CliArgs;
|
||||||
use crate::pane_size::PositionAndSize;
|
use crate::pane_size::PositionAndSize;
|
||||||
use crate::{
|
use crate::{
|
||||||
errors::{get_current_ctx, ErrorContext},
|
errors::{get_current_ctx, ErrorContext},
|
||||||
input::{actions::Action, options::Options},
|
input::{actions::Action, layout::Layout, options::Options},
|
||||||
};
|
};
|
||||||
use interprocess::local_socket::LocalSocketStream;
|
use interprocess::local_socket::LocalSocketStream;
|
||||||
use nix::unistd::dup;
|
use nix::unistd::dup;
|
||||||
|
|
@ -56,7 +56,7 @@ pub enum ClientToServerMsg {
|
||||||
// Disconnect from the session we're connected to
|
// Disconnect from the session we're connected to
|
||||||
DisconnectFromSession,*/
|
DisconnectFromSession,*/
|
||||||
TerminalResize(PositionAndSize),
|
TerminalResize(PositionAndSize),
|
||||||
NewClient(ClientAttributes, Box<CliArgs>, Box<Options>),
|
NewClient(ClientAttributes, Box<CliArgs>, Box<Options>, Option<Layout>),
|
||||||
AttachClient(ClientAttributes, bool, Options),
|
AttachClient(ClientAttributes, bool, Options),
|
||||||
Action(Action),
|
Action(Action),
|
||||||
ClientExited,
|
ClientExited,
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue