summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authora-kenji <aks.kenji@protonmail.com>2021-05-12 20:03:04 +0200
committera-kenji <aks.kenji@protonmail.com>2021-05-12 20:03:04 +0200
commit4134c952f65aa2951404991bcf525462e3482fe9 (patch)
treecf809552c3f676c5dee56873052a5a584e377623 /src
parentffd8f17a94e60dc7fffea0a1ef5efccc693c5cd9 (diff)
parent34f0bf172d7eb4cf869fcc6f2b13ae9c9d4e424c (diff)
Merge branch 'main' of https://github.com/zellij-org/zellij into set-data-dir
Diffstat (limited to 'src')
-rw-r--r--src/cli.rs14
-rw-r--r--src/client/layout.rs2
-rw-r--r--src/client/mod.rs21
-rw-r--r--src/client/panes/grid.rs296
-rw-r--r--src/client/panes/plugin_pane.rs11
-rw-r--r--src/client/panes/terminal_character.rs281
-rw-r--r--src/client/panes/terminal_pane.rs23
-rw-r--r--src/client/panes/unit/grid_tests.rs36
-rw-r--r--src/client/panes/unit/snapshots/zellij__client__panes__grid__grid_tests__csi_b.snap8
-rw-r--r--src/client/panes/unit/snapshots/zellij__client__panes__grid__grid_tests__csi_capital_i.snap8
-rw-r--r--src/client/panes/unit/snapshots/zellij__client__panes__grid__grid_tests__csi_capital_z.snap8
-rw-r--r--src/client/panes/unit/snapshots/zellij__client__panes__grid__grid_tests__vttest2_0.snap19
-rw-r--r--src/client/panes/unit/snapshots/zellij__client__panes__grid__grid_tests__vttest2_1.snap19
-rw-r--r--src/client/panes/unit/snapshots/zellij__client__panes__grid__grid_tests__vttest2_10.snap65
-rw-r--r--src/client/panes/unit/snapshots/zellij__client__panes__grid__grid_tests__vttest2_11.snap65
-rw-r--r--src/client/panes/unit/snapshots/zellij__client__panes__grid__grid_tests__vttest2_12.snap65
-rw-r--r--src/client/panes/unit/snapshots/zellij__client__panes__grid__grid_tests__vttest2_13.snap65
-rw-r--r--src/client/panes/unit/snapshots/zellij__client__panes__grid__grid_tests__vttest2_14.snap65
-rw-r--r--src/client/panes/unit/snapshots/zellij__client__panes__grid__grid_tests__vttest2_2.snap19
-rw-r--r--src/client/panes/unit/snapshots/zellij__client__panes__grid__grid_tests__vttest2_3.snap19
-rw-r--r--src/client/panes/unit/snapshots/zellij__client__panes__grid__grid_tests__vttest2_4.snap19
-rw-r--r--src/client/panes/unit/snapshots/zellij__client__panes__grid__grid_tests__vttest2_5.snap19
-rw-r--r--src/client/panes/unit/snapshots/zellij__client__panes__grid__grid_tests__vttest2_6.snap19
-rw-r--r--src/client/panes/unit/snapshots/zellij__client__panes__grid__grid_tests__vttest2_7.snap17
-rw-r--r--src/client/panes/unit/snapshots/zellij__client__panes__grid__grid_tests__vttest2_8.snap61
-rw-r--r--src/client/panes/unit/snapshots/zellij__client__panes__grid__grid_tests__vttest2_9.snap17
-rw-r--r--src/client/panes/unit/snapshots/zellij__client__panes__grid__grid_tests__vttest3_0.snap17
-rw-r--r--src/client/panes/unit/snapshots/zellij__client__panes__grid__grid_tests__vttest8_0.snap27
-rw-r--r--src/client/panes/unit/snapshots/zellij__client__panes__grid__grid_tests__vttest8_1.snap27
-rw-r--r--src/client/panes/unit/snapshots/zellij__client__panes__grid__grid_tests__vttest8_2.snap27
-rw-r--r--src/client/panes/unit/snapshots/zellij__client__panes__grid__grid_tests__vttest8_3.snap27
-rw-r--r--src/client/panes/unit/snapshots/zellij__client__panes__grid__grid_tests__vttest8_4.snap27
-rw-r--r--src/client/panes/unit/snapshots/zellij__client__panes__grid__grid_tests__vttest8_5.snap27
-rw-r--r--src/client/tab.rs125
-rw-r--r--src/common/errors.rs22
-rw-r--r--src/common/input/actions.rs7
-rw-r--r--src/common/input/config.rs21
-rw-r--r--src/common/input/handler.rs42
-rw-r--r--src/common/input/keybinds.rs138
-rw-r--r--src/common/input/mod.rs1
-rw-r--r--src/common/input/options.rs45
-rw-r--r--src/common/input/unit/keybinds_test.rs653
-rw-r--r--src/common/mod.rs65
-rw-r--r--src/common/os_input_output.rs6
-rw-r--r--src/common/pty.rs (renamed from src/common/pty_bus.rs)165
-rw-r--r--src/common/screen.rs341
-rw-r--r--src/common/setup.rs6
-rw-r--r--src/common/thread_bus.rs142
-rw-r--r--src/common/utils/consts.rs2
-rw-r--r--src/common/utils/logging.rs18
-rw-r--r--src/common/wasm_vm.rs138
-rw-r--r--src/main.rs21
-rw-r--r--src/server/mod.rs772
-rw-r--r--src/server/route.rs229
-rw-r--r--src/tests/fakes.rs2
-rw-r--r--src/tests/fixtures/csi-b1
-rw-r--r--src/tests/fixtures/csi-capital-i1
-rw-r--r--src/tests/fixtures/csi-capital-z1
-rw-r--r--src/tests/integration/basic.rs64
-rw-r--r--src/tests/integration/close_pane.rs15
-rw-r--r--src/tests/integration/compatibility.rs22
-rw-r--r--src/tests/integration/layouts.rs3
-rw-r--r--src/tests/integration/move_focus_down.rs4
-rw-r--r--src/tests/integration/move_focus_left.rs48
-rw-r--r--src/tests/integration/move_focus_right.rs48
-rw-r--r--src/tests/integration/move_focus_up.rs4
-rw-r--r--src/tests/integration/resize_down.rs15
-rw-r--r--src/tests/integration/resize_left.rs15
-rw-r--r--src/tests/integration/resize_right.rs15
-rw-r--r--src/tests/integration/resize_up.rs15
-rw-r--r--src/tests/integration/snapshots/zellij__tests__integration__basic__bracketed_paste.snap25
-rw-r--r--src/tests/integration/snapshots/zellij__tests__integration__compatibility__htop_scrolling.snap2
-rw-r--r--src/tests/integration/snapshots/zellij__tests__integration__move_focus_left__move_focus_left_changes_tab.snap25
-rw-r--r--src/tests/integration/snapshots/zellij__tests__integration__move_focus_right__move_focus_right_changes_tab.snap25
-rw-r--r--src/tests/integration/tabs.rs10
-rw-r--r--src/tests/integration/terminal_window_resize.rs6
-rw-r--r--src/tests/integration/toggle_fullscreen.rs4
-rw-r--r--src/tests/utils.rs7
78 files changed, 3348 insertions, 1428 deletions
diff --git a/src/cli.rs b/src/cli.rs
index 91b0ed39d..b95b5770d 100644
--- a/src/cli.rs
+++ b/src/cli.rs
@@ -1,4 +1,5 @@
use super::common::utils::consts::{ZELLIJ_CONFIG_DIR_ENV, ZELLIJ_CONFIG_FILE_ENV};
+use crate::common::input::options::Options;
use serde::{Deserialize, Serialize};
use std::path::PathBuf;
use structopt::StructOpt;
@@ -36,21 +37,20 @@ pub struct CliArgs {
#[derive(Debug, StructOpt, Clone, Serialize, Deserialize)]
pub enum ConfigCli {
/// Change the behaviour of zellij
- #[structopt(name = "option")]
- Config {
- /// Disables loading of configuration file at default location
- #[structopt(long)]
- clean: bool,
- },
+ #[structopt(name = "options")]
+ Options(Options),
#[structopt(name = "generate-completion")]
GenerateCompletion { shell: String },
#[structopt(name = "setup")]
Setup {
- /// Disables loading of configuration file at default location
/// Dump the default configuration file to stdout
#[structopt(long)]
dump_config: bool,
+ /// Disables loading of configuration file at default location,
+ /// loads the defaults that zellij ships with
+ #[structopt(long)]
+ clean: bool,
},
}
diff --git a/src/client/layout.rs b/src/client/layout.rs
index ca1adb4dc..3648ece90 100644
--- a/src/client/layout.rs
+++ b/src/client/layout.rs
@@ -206,7 +206,7 @@ impl Layout {
}
// It wants to use Path here, but that doesn't compile.
- #[warn(clippy::ptr_arg)]
+ #[allow(clippy::ptr_arg)]
pub fn from_defaults(layout_path: &PathBuf, data_dir: &Path) -> Self {
Self::new(
&data_dir
diff --git a/src/client/mod.rs b/src/client/mod.rs
index 8a5834f06..6f298615f 100644
--- a/src/client/mod.rs
+++ b/src/client/mod.rs
@@ -15,8 +15,9 @@ use crate::common::{
errors::{ClientContext, ContextType},
input::config::Config,
input::handler::input_loop,
+ input::options::Options,
os_input_output::ClientOsApi,
- SenderType, SenderWithContext, SyncChannelWithContext,
+ thread_bus::{SenderType, SenderWithContext, SyncChannelWithContext},
};
use crate::server::ServerInstruction;
@@ -30,20 +31,36 @@ pub enum ClientInstruction {
}
pub fn start_client(mut os_input: Box<dyn ClientOsApi>, opts: CliArgs, config: Config) {
+ 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 bracketed_paste = "\u{1b}[?2004h";
os_input.unset_raw_mode(0);
let _ = os_input
.get_stdout_writer()
.write(take_snapshot.as_bytes())
.unwrap();
+ let _ = os_input
+ .get_stdout_writer()
+ .write(clear_client_terminal_attributes.as_bytes())
+ .unwrap();
std::env::set_var(&"ZELLIJ", "0");
let mut command_is_executing = CommandIsExecuting::new();
+ let config_options = Options::from_cli(&config.options, opts.option.clone());
+
let full_screen_ws = os_input.get_terminal_size_using_fd(0);
os_input.connect_to_server();
- os_input.send_to_server(ServerInstruction::NewClient(full_screen_ws, opts));
+ os_input.send_to_server(ServerInstruction::NewClient(
+ full_screen_ws,
+ opts,
+ config_options,
+ ));
os_input.set_raw_mode(0);
+ let _ = os_input
+ .get_stdout_writer()
+ .write(bracketed_paste.as_bytes())
+ .unwrap();
let (send_client_instructions, receive_client_instructions): SyncChannelWithContext<
ClientInstruction,
diff --git a/src/client/panes/grid.rs b/src/client/panes/grid.rs
index e893fd324..c59e279b2 100644
--- a/src/client/panes/grid.rs
+++ b/src/client/panes/grid.rs
@@ -4,13 +4,15 @@ use std::{