diff options
| author | divens <divens@users.noreply.github.com> | 2026-02-18 15:07:19 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-02-18 15:07:19 +0100 |
| commit | 36fa696c1a71b236e27d62bac26e4f0ee136cde4 (patch) | |
| tree | d46e371641be07247c5f825a698e90b48d23c64e /zellij-client/src/lib.rs | |
| parent | refactor: replace nix::Error with std::io::Error in public APIs (#4720) (diff) | |
| download | sl0ppij-36fa696c1a71b236e27d62bac26e4f0ee136cde4.tar.gz sl0ppij-36fa696c1a71b236e27d62bac26e4f0ee136cde4.tar.xz sl0ppij-36fa696c1a71b236e27d62bac26e4f0ee136cde4.zip | |
[Windows port PR2] Replace client-side termios/ioctl with crossterm for raw mode and terminal size (#4721)
* refactor: replace nix::Error with std::io::Error in public APIs
* refactor: replace client-side termios/ioctl with crossterm
---------
Co-authored-by: divens <divens.dev@gmail.com>
Diffstat (limited to 'zellij-client/src/lib.rs')
| -rw-r--r-- | zellij-client/src/lib.rs | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/zellij-client/src/lib.rs b/zellij-client/src/lib.rs index 4061b690..e7b6bc97 100644 --- a/zellij-client/src/lib.rs +++ b/zellij-client/src/lib.rs @@ -300,7 +300,7 @@ pub async fn run_remote_client_terminal_loop( }; // send size on startup - let new_size = os_input.get_terminal_size_using_fd(0); + let new_size = os_input.get_terminal_size(); if let Err(e) = connections .control_ws .send(create_resize_message(new_size)) @@ -335,7 +335,7 @@ pub async fn run_remote_client_terminal_loop( Some(signal) = async_signals.recv() => { match signal { crate::os_input_output::SignalEvent::Resize => { - let new_size = os_input.get_terminal_size_using_fd(0); + let new_size = os_input.get_terminal_size(); if let Err(e) = connections.control_ws.send(create_resize_message(new_size)).await { log::error!("Failed to send resize message: {}", e); break; @@ -409,7 +409,7 @@ pub async fn run_remote_client_terminal_loop( // no-op } Ok(WebServerToWebClientControlMessage::QueryTerminalSize) => { - let new_size = os_input.get_terminal_size_using_fd(0); + let new_size = os_input.get_terminal_size(); if let Err(e) = connections.control_ws.send(create_resize_message(new_size)).await { log::error!("Failed to send resize message: {}", e); } @@ -477,7 +477,7 @@ pub fn start_remote_client( let take_snapshot = "\u{1b}[?1049h"; let bracketed_paste = "\u{1b}[?2004h"; let enter_kitty_keyboard_mode = "\u{1b}[>1u"; - os_input.unset_raw_mode(0).unwrap(); + os_input.unset_raw_mode().unwrap(); let _ = os_input .get_stdout_writer() @@ -494,9 +494,9 @@ pub fn start_remote_client( envs::set_zellij("0".to_string()); - let full_screen_ws = os_input.get_terminal_size_using_fd(0); + let full_screen_ws = os_input.get_terminal_size(); - os_input.set_raw_mode(0); + os_input.set_raw_mode(); let _ = os_input .get_stdout_writer() .write(bracketed_paste.as_bytes()) @@ -506,14 +506,14 @@ pub fn start_remote_client( use zellij_utils::errors::handle_panic; let os_input = os_input.clone(); Box::new(move |info| { - if let Ok(()) = os_input.unset_raw_mode(0) { + if let Ok(()) = os_input.unset_raw_mode() { handle_panic::<ClientInstruction>(info, None); } }) }); let reset_controlling_terminal_state = |e: String, exit_status: i32| { - os_input.unset_raw_mode(0).unwrap(); + os_input.unset_raw_mode().unwrap(); let goto_start_of_last_line = format!("\u{1b}[{};{}H", full_screen_ws.rows, 1); let restore_alternate_screen = "\u{1b}[?1049l"; let exit_kitty_keyboard_mode = "\u{1b}[<1u"; @@ -589,7 +589,7 @@ pub fn start_client( let take_snapshot = "\u{1b}[?1049h"; let bracketed_paste = "\u{1b}[?2004h"; let enter_kitty_keyboard_mode = "\u{1b}[>1u"; - os_input.unset_raw_mode(0).unwrap(); + os_input.unset_raw_mode().unwrap(); if !is_a_reconnect { // we don't do this for a reconnect because our controlling terminal already has the @@ -613,7 +613,7 @@ pub fn start_client( envs::set_zellij("0".to_string()); config.env.set_vars(); - let full_screen_ws = os_input.get_terminal_size_using_fd(0); + let full_screen_ws = os_input.get_terminal_size(); let web_server_ip = config_options .web_server_ip @@ -793,7 +793,7 @@ pub fn start_client( let mut command_is_executing = CommandIsExecuting::new(); - os_input.set_raw_mode(0); + os_input.set_raw_mode(); let _ = os_input .get_stdout_writer() .write(bracketed_paste.as_bytes()) @@ -814,7 +814,7 @@ pub fn start_client( let send_client_instructions = send_client_instructions.clone(); let os_input = os_input.clone(); Box::new(move |info| { - if let Ok(()) = os_input.unset_raw_mode(0) { + if let Ok(()) = os_input.unset_raw_mode() { handle_panic(info, Some(&send_client_instructions)); } }) @@ -869,7 +869,7 @@ pub fn start_client( let os_api = os_input.clone(); move || { os_api.send_to_server(ClientToServerMsg::TerminalResize { - new_size: os_api.get_terminal_size_using_fd(0), + new_size: os_api.get_terminal_size(), }); } }), @@ -929,7 +929,7 @@ pub fn start_client( .unwrap(); let handle_error = |backtrace: String| { - os_input.unset_raw_mode(0).unwrap(); + os_input.unset_raw_mode().unwrap(); let goto_start_of_last_line = format!("\u{1b}[{};{}H", full_screen_ws.rows, 1); let restore_snapshot = "\u{1b}[?1049l"; os_input.disable_mouse().non_fatal(); @@ -1073,7 +1073,7 @@ pub fn start_client( }, ClientInstruction::QueryTerminalSize => { os_input.send_to_server(ClientToServerMsg::TerminalResize { - new_size: os_input.get_terminal_size_using_fd(0), + new_size: os_input.get_terminal_size(), }); }, ClientInstruction::StartWebServer => { @@ -1114,7 +1114,7 @@ pub fn start_client( os_input.disable_mouse().non_fatal(); info!("{}", exit_msg); - os_input.unset_raw_mode(0).unwrap(); + os_input.unset_raw_mode().unwrap(); let mut stdout = os_input.get_stdout_writer(); let exit_kitty_keyboard_mode = "\u{1b}[<1u"; if !explicitly_disable_kitty_keyboard_protocol { |
