diff options
author | Aram Drevekenin <aram@poor.dev> | 2022-10-02 13:40:24 +0200 |
---|---|---|
committer | Aram Drevekenin <aram@poor.dev> | 2022-10-02 13:40:24 +0200 |
commit | d9624d888da874c3be155a85dfe3ab079f90621e (patch) | |
tree | 03cb475c7779e02b705edf927942b8bfa4ef690b | |
parent | e4fb8d8111394253c0a592a79804ed82acf9a934 (diff) |
fix(screen): propagate errors after merge
-rw-r--r-- | zellij-server/src/screen.rs | 32 | ||||
-rw-r--r-- | zellij-server/src/tab/unit/tab_integration_tests.rs | 2 | ||||
-rw-r--r-- | zellij-server/src/unit/screen_tests.rs | 3 |
3 files changed, 18 insertions, 19 deletions
diff --git a/zellij-server/src/screen.rs b/zellij-server/src/screen.rs index 7ae60f4a8..229dd6f01 100644 --- a/zellij-server/src/screen.rs +++ b/zellij-server/src/screen.rs @@ -603,9 +603,7 @@ impl Screen { self.close_tab_at_index(active_tab_index) .with_context(err_context) }, - None => { - Ok(()) - } + None => Ok(()), } } @@ -744,7 +742,12 @@ impl Screen { /// Creates a new [`Tab`] in this [`Screen`], applying the specified [`Layout`] /// and switching to it. - pub fn new_tab(&mut self, layout: PaneLayout, new_pids: Vec<RawFd>, client_id: ClientId) -> Result<()> { + pub fn new_tab( + &mut self, + layout: PaneLayout, + new_pids: Vec<RawFd>, + client_id: ClientId, + ) -> Result<()> { let client_id = if self.get_active_tab(client_id).is_some() { client_id } else if let Some(first_client_id) = self.get_first_client_id() { @@ -937,9 +940,7 @@ impl Screen { Ok(()) } }, - None => { - Ok(()) - } + None => Ok(()), } } pub fn undo_active_rename_tab(&mut self, client_id: ClientId) -> Result<()> { @@ -961,10 +962,7 @@ impl Screen { } Ok(()) }, - None => { - Ok(()) - - } + None => Ok(()), } } @@ -1186,8 +1184,8 @@ pub(crate) fn screen_thread_main( .toggle_floating_panes(client_id, default_shell) ); screen.unblock_input(); - screen.update_tabs(); // update tabs so that the ui indication will be send to the plugins - screen.render(); + screen.update_tabs()?; // update tabs so that the ui indication will be send to the plugins + screen.render()?; }, ScreenInstruction::ShowFloatingPanes(client_id) => { active_tab_and_connected_client_id!( @@ -1196,8 +1194,8 @@ pub(crate) fn screen_thread_main( |tab: &mut Tab, _client_id: ClientId| tab.show_floating_panes() ); screen.unblock_input(); - screen.update_tabs(); // update tabs so that the ui indication will be send to the plugins - screen.render(); + screen.update_tabs()?; // update tabs so that the ui indication will be send to the plugins + screen.render()?; }, ScreenInstruction::HideFloatingPanes(client_id) => { active_tab_and_connected_client_id!( @@ -1553,7 +1551,7 @@ pub(crate) fn screen_thread_main( client_id, |tab: &mut Tab, client_id: ClientId| tab.undo_active_rename_pane(client_id) ); - screen.render(); + screen.render()?; screen.render()?; }, ScreenInstruction::ToggleActiveTerminalFullscreen(client_id) => { @@ -1637,7 +1635,7 @@ pub(crate) fn screen_thread_main( }, ScreenInstruction::ChangeModeForAllClients(mode_info) => { screen.change_mode_for_all_clients(mode_info); - screen.render(); + screen.render()?; }, ScreenInstruction::ToggleActiveSyncTab(client_id) => { active_tab_and_connected_client_id!( diff --git a/zellij-server/src/tab/unit/tab_integration_tests.rs b/zellij-server/src/tab/unit/tab_integration_tests.rs index 84f2e1c24..3b26bc26e 100644 --- a/zellij-server/src/tab/unit/tab_integration_tests.rs +++ b/zellij-server/src/tab/unit/tab_integration_tests.rs @@ -12,8 +12,8 @@ use crate::{ use std::path::PathBuf; use zellij_utils::channels::Receiver; use zellij_utils::envs::set_session_name; -use zellij_utils::input::layout::{Layout, PaneLayout}; use zellij_utils::errors::ErrorContext; +use zellij_utils::input::layout::{Layout, PaneLayout}; use zellij_utils::ipc::IpcReceiverWithContext; use zellij_utils::pane_size::{Size, SizeInPixels}; use zellij_utils::position::Position; diff --git a/zellij-server/src/unit/screen_tests.rs b/zellij-server/src/unit/screen_tests.rs index 3190a18eb..c86fdb94b 100644 --- a/zellij-server/src/unit/screen_tests.rs +++ b/zellij-server/src/unit/screen_tests.rs @@ -411,7 +411,8 @@ macro_rules! log_actions_in_thread { fn new_tab(screen: &mut Screen, pid: i32) { let client_id = 1; - screen.new_tab(PaneLayout::default(), vec![pid], client_id) + screen + .new_tab(PaneLayout::default(), vec![pid], client_id) .expect("TEST"); } |