diff options
author | a-kenji <aks.kenji@protonmail.com> | 2021-05-30 15:17:55 +0200 |
---|---|---|
committer | a-kenji <aks.kenji@protonmail.com> | 2021-05-30 15:17:55 +0200 |
commit | 0be151fa28b6b0634271091f961048e8318fddc2 (patch) | |
tree | 382d3e3fe0a73ff127e19dd693589bcca824b842 /zellij-client | |
parent | ce73b6cca0d6132a57a5a7a2321e1cec8b071720 (diff) | |
parent | fe299325eb54e6642d27a417a3922a757b4390e4 (diff) |
Merge branch 'main' of https://github.com/zellij-org/zellij into theme-config
Diffstat (limited to 'zellij-client')
-rw-r--r-- | zellij-client/src/input_handler.rs | 5 | ||||
-rw-r--r-- | zellij-client/src/lib.rs | 16 | ||||
-rw-r--r-- | zellij-client/src/os_input_output.rs | 8 |
3 files changed, 22 insertions, 7 deletions
diff --git a/zellij-client/src/input_handler.rs b/zellij-client/src/input_handler.rs index 70f6e9824..65181e512 100644 --- a/zellij-client/src/input_handler.rs +++ b/zellij-client/src/input_handler.rs @@ -33,9 +33,10 @@ impl InputHandler { command_is_executing: CommandIsExecuting, config: Config, send_client_instructions: SenderWithContext<ClientInstruction>, + mode: InputMode, ) -> Self { InputHandler { - mode: InputMode::Normal, + mode, os_input, config, command_is_executing, @@ -181,12 +182,14 @@ pub(crate) fn input_loop( config: Config, command_is_executing: CommandIsExecuting, send_client_instructions: SenderWithContext<ClientInstruction>, + default_mode: InputMode, ) { let _handler = InputHandler::new( os_input, command_is_executing, config, send_client_instructions, + default_mode, ) .handle_input(); } diff --git a/zellij-client/src/lib.rs b/zellij-client/src/lib.rs index 7ea4f81ee..ece154ea7 100644 --- a/zellij-client/src/lib.rs +++ b/zellij-client/src/lib.rs @@ -77,7 +77,7 @@ fn spawn_server(socket_path: &Path) -> io::Result<()> { #[derive(Debug, Clone)] pub enum ClientInfo { - Attach(String, bool), + Attach(String, bool, Options), New(String), } @@ -117,11 +117,11 @@ pub fn start_client( #[cfg(not(any(feature = "test", test)))] let first_msg = match info { - ClientInfo::Attach(name, force) => { + ClientInfo::Attach(name, force, config_options) => { SESSION_NAME.set(name).unwrap(); std::env::set_var(&"ZELLIJ_SESSION_NAME", SESSION_NAME.get().unwrap()); - ClientToServerMsg::AttachClient(client_attributes, force) + ClientToServerMsg::AttachClient(client_attributes, force, config_options) } ClientInfo::New(name) => { SESSION_NAME.set(name).unwrap(); @@ -132,14 +132,18 @@ pub fn start_client( ClientToServerMsg::NewClient( client_attributes, Box::new(opts), - Box::new(config_options), + Box::new(config_options.clone()), ) } }; #[cfg(any(feature = "test", test))] let first_msg = { let _ = SESSION_NAME.set("".into()); - ClientToServerMsg::NewClient(client_attributes, Box::new(opts), Box::new(config_options)) + ClientToServerMsg::NewClient( + client_attributes, + Box::new(opts), + Box::new(config_options.clone()), + ) }; os_input.connect_to_server(&*ZELLIJ_IPC_PIPE); @@ -173,12 +177,14 @@ pub fn start_client( let send_client_instructions = send_client_instructions.clone(); let command_is_executing = command_is_executing.clone(); let os_input = os_input.clone(); + let default_mode = config_options.default_mode.unwrap_or_default(); move || { input_loop( os_input, config, command_is_executing, send_client_instructions, + default_mode, ) } }); diff --git a/zellij-client/src/os_input_output.rs b/zellij-client/src/os_input_output.rs index 0606ae374..405422abc 100644 --- a/zellij-client/src/os_input_output.rs +++ b/zellij-client/src/os_input_output.rs @@ -45,7 +45,13 @@ pub(crate) fn get_terminal_size_using_fd(fd: RawFd) -> PositionAndSize { ws_ypixel: 0, }; - unsafe { ioctl(fd, TIOCGWINSZ, &mut winsize) }; + // TIOCGWINSZ is an u32, but the second argument to ioctl is u64 on + // some platforms. When checked on Linux, clippy will complain about + // useless conversion. + #[allow(clippy::useless_conversion)] + unsafe { + ioctl(fd, TIOCGWINSZ.into(), &mut winsize) + }; PositionAndSize::from(winsize) } |