diff options
author | a-kenji <aks.kenji@protonmail.com> | 2021-05-12 20:03:04 +0200 |
---|---|---|
committer | a-kenji <aks.kenji@protonmail.com> | 2021-05-12 20:03:04 +0200 |
commit | 4134c952f65aa2951404991bcf525462e3482fe9 (patch) | |
tree | cf809552c3f676c5dee56873052a5a584e377623 /src | |
parent | ffd8f17a94e60dc7fffea0a1ef5efccc693c5cd9 (diff) | |
parent | 34f0bf172d7eb4cf869fcc6f2b13ae9c9d4e424c (diff) |
Merge branch 'main' of https://github.com/zellij-org/zellij into set-data-dir
Diffstat (limited to 'src')
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::{ |