diff options
author | Kunal Mohan <kunalmohan99@gmail.com> | 2021-05-12 22:27:25 +0530 |
---|---|---|
committer | Kunal Mohan <kunalmohan99@gmail.com> | 2021-05-15 22:14:34 +0530 |
commit | 41212dc0e8b139fccac443297c06b9478857d5ea (patch) | |
tree | 125055787a3960bd94d1a97c312ea01760e4362c /src | |
parent | e203f96d78865f3710061934c82cca1e5dd78fa9 (diff) |
Fix after rebase
Diffstat (limited to 'src')
-rw-r--r-- | src/client/mod.rs | 13 | ||||
-rw-r--r-- | src/common/ipc.rs | 4 | ||||
-rw-r--r-- | src/main.rs | 4 | ||||
-rw-r--r-- | src/server/mod.rs | 23 | ||||
-rw-r--r-- | src/server/route.rs | 7 | ||||
-rw-r--r-- | src/tests/mod.rs | 5 |
6 files changed, 41 insertions, 15 deletions
diff --git a/src/client/mod.rs b/src/client/mod.rs index c1458b1a6..2fada5929 100644 --- a/src/client/mod.rs +++ b/src/client/mod.rs @@ -17,6 +17,7 @@ use crate::common::{ errors::ContextType, input::config::Config, input::handler::input_loop, + input::options::Options, ipc::{ClientToServerMsg, ServerToClientMsg}, os_input_output::ClientOsApi, thread_bus::{SenderType, SenderWithContext, SyncChannelWithContext}, @@ -62,6 +63,7 @@ fn spawn_server(socket_path: &Path) -> io::Result<()> { } 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); @@ -69,7 +71,10 @@ pub fn start_client(mut os_input: Box<dyn ClientOsApi>, opts: CliArgs, config: C .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"); #[cfg(not(test))] @@ -81,7 +86,11 @@ pub fn start_client(mut os_input: Box<dyn ClientOsApi>, opts: CliArgs, config: C let full_screen_ws = os_input.get_terminal_size_using_fd(0); os_input.connect_to_server(&*ZELLIJ_IPC_PIPE); - os_input.send_to_server(ClientToServerMsg::NewClient(full_screen_ws, opts)); + os_input.send_to_server(ClientToServerMsg::NewClient( + full_screen_ws, + opts, + config_options, + )); os_input.set_raw_mode(0); let _ = os_input .get_stdout_writer() diff --git a/src/common/ipc.rs b/src/common/ipc.rs index 38a2fd4fc..129727a1a 100644 --- a/src/common/ipc.rs +++ b/src/common/ipc.rs @@ -3,7 +3,7 @@ use crate::cli::CliArgs; use crate::common::{ errors::{get_current_ctx, ErrorContext}, - input::actions::Action, + input::{actions::Action, options::Options}, }; use crate::panes::PositionAndSize; use interprocess::local_socket::LocalSocketStream; @@ -47,7 +47,7 @@ pub enum ClientToServerMsg { DisconnectFromSession,*/ ClientExit, TerminalResize(PositionAndSize), - NewClient(PositionAndSize, CliArgs), + NewClient(PositionAndSize, CliArgs, Options), Action(Action), } diff --git a/src/main.rs b/src/main.rs index 5acd6df53..25c363a51 100644 --- a/src/main.rs +++ b/src/main.rs @@ -14,7 +14,7 @@ use structopt::StructOpt; use crate::cli::CliArgs; use crate::command_is_executing::CommandIsExecuting; -use crate::common::input::config::Config; +use crate::common::input::{config::Config, options::Options}; use crate::os_input_output::{get_client_os_input, get_server_os_input}; use crate::utils::{ consts::{ZELLIJ_TMP_DIR, ZELLIJ_TMP_LOG_DIR}, @@ -41,7 +41,7 @@ pub fn main() { atomic_create_dir(&*ZELLIJ_TMP_LOG_DIR).unwrap(); if let Some(path) = opts.server { let os_input = get_server_os_input(); - start_server(Box::new(os_input), path); + start_server(Box::new(os_input), path, config_options); } else { let os_input = get_client_os_input(); start_client(Box::new(os_input), opts, config); diff --git a/src/server/mod.rs b/src/server/mod.rs index 4d52e7799..afa846e81 100644 --- a/src/server/mod.rs +++ b/src/server/mod.rs @@ -10,6 +10,7 @@ use crate::cli::CliArgs; use crate::common::thread_bus::{Bus, ThreadSenders}; use crate::common::{ errors::ContextType, + input::options::Options, ipc::{ClientToServerMsg, ServerToClientMsg}, os_input_output::ServerOsApi, pty::{pty_thread_main, Pty, PtyInstruction}, @@ -27,7 +28,7 @@ use route::route_thread_main; /// ones sent by client to server #[derive(Debug, Clone)] pub enum ServerInstruction { - NewClient(PositionAndSize, CliArgs), + NewClient(PositionAndSize, CliArgs, Options), Render(Option<String>), UnblockInputThread, ClientExit, @@ -38,7 +39,9 @@ impl From<ClientToServerMsg> for ServerInstruction { fn from(instruction: ClientToServerMsg) -> Self { match instruction { ClientToServerMsg::ClientExit => ServerInstruction::ClientExit, - ClientToServerMsg::NewClient(pos, opts) => ServerInstruction::NewClient(pos, opts), + ClientToServerMsg::NewClient(pos, opts, options) => { + ServerInstruction::NewClient(pos, opts, options) + } _ => unreachable!(), } } @@ -62,7 +65,7 @@ impl Drop for SessionMetaData { } } -pub fn start_server(os_input: Box<dyn ServerOsApi>, socket_path: PathBuf) { +pub fn start_server(os_input: Box<dyn ServerOsApi>, socket_path: PathBuf, config_options: Options) { #[cfg(not(test))] daemonize::Daemonize::new() .working_directory(std::env::var("HOME").unwrap()) @@ -111,6 +114,9 @@ pub fn start_server(os_input: Box<dyn ServerOsApi>, socket_path: PathBuf) { let sessions = sessions.clone(); let to_server = to_server.clone(); let socket_path = socket_path.clone(); + let capabilities = PluginCapabilities { + arrow_fonts: config_options.simplified_ui, + }; move || { drop(std::fs::remove_file(&socket_path)); let listener = LocalSocketListener::bind(&*socket_path).unwrap(); @@ -152,9 +158,14 @@ pub fn start_server(os_input: Box<dyn ServerOsApi>, socket_path: PathBuf) { let (instruction, mut err_ctx) = server_receiver.recv().unwrap(); err_ctx.add_call(ContextType::IPCServer((&instruction).into())); match instruction { - ServerInstruction::NewClient(full_screen_ws, opts) => { - let session_data = - init_session(os_input.clone(), opts, to_server.clone(), full_screen_ws); + ServerInstruction::NewClient(full_screen_ws, opts, config_options) => { + let session_data = init_session( + os_input.clone(), + opts, + config_options, + to_server.clone(), + full_screen_ws, + ); *sessions.write().unwrap() = Some(session_data); sessions .read() diff --git a/src/server/route.rs b/src/server/route.rs index 31b82eb58..34db835ff 100644 --- a/src/server/route.rs +++ b/src/server/route.rs @@ -202,7 +202,12 @@ pub fn route_thread_main( break; } ClientToServerMsg::Action(action) => { - route_action(action, rlocked_sessions.as_ref().unwrap(), &*os_input); + route_action( + action, + rlocked_sessions.as_ref().unwrap(), + &*os_input, + capabilities, + ); } ClientToServerMsg::TerminalResize(new_size) => { rlocked_sessions diff --git a/src/tests/mod.rs b/src/tests/mod.rs index 7aaad79fa..86391456b 100644 --- a/src/tests/mod.rs +++ b/src/tests/mod.rs @@ -6,7 +6,7 @@ pub mod utils; use crate::cli::CliArgs; use crate::client::start_client; -use crate::common::input::config::Config; +use crate::common::input::{config::Config, options::Options}; use crate::os_input_output::{ClientOsApi, ServerOsApi}; use crate::server::start_server; use std::path::PathBuf; @@ -16,11 +16,12 @@ pub fn start( opts: CliArgs, server_os_input: Box<dyn ServerOsApi>, config: Config, + config_options: Options, ) { let server_thread = std::thread::Builder::new() .name("server_thread".into()) .spawn(move || { - start_server(server_os_input, PathBuf::from("")); + start_server(server_os_input, PathBuf::from(""), config_options); }) .unwrap(); start_client(client_os_input, opts, config); |