diff options
author | Aram Drevekenin <aram@poor.dev> | 2021-12-08 18:41:41 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-08 18:41:41 +0100 |
commit | 92bddf1b798ec4ecfce8831552e1f218273bb50f (patch) | |
tree | aa65624c877a1407ede75a414461559e0cbb530f /zellij-server/src/ui | |
parent | 56e85f87d6c365816cca71c496aa7e49709e0b11 (diff) |
fix(plugins): support multiple users (#930)
* fix(plugins): support multiple clients
* fix(style): make clippy happy
Diffstat (limited to 'zellij-server/src/ui')
-rw-r--r-- | zellij-server/src/ui/pane_contents_and_ui.rs | 31 |
1 files changed, 24 insertions, 7 deletions
diff --git a/zellij-server/src/ui/pane_contents_and_ui.rs b/zellij-server/src/ui/pane_contents_and_ui.rs index 402724360..f2742f17e 100644 --- a/zellij-server/src/ui/pane_contents_and_ui.rs +++ b/zellij-server/src/ui/pane_contents_and_ui.rs @@ -13,7 +13,6 @@ pub struct PaneContentsAndUi<'a> { colors: Palette, focused_clients: Vec<ClientId>, multiple_users_exist_in_session: bool, - mode: InputMode, // TODO: per client } impl<'a> PaneContentsAndUi<'a> { @@ -22,7 +21,6 @@ impl<'a> PaneContentsAndUi<'a> { output: &'a mut Output, colors: Palette, active_panes: &HashMap<ClientId, PaneId>, - mode: InputMode, ) -> Self { let focused_clients: Vec<ClientId> = active_panes .iter() @@ -36,11 +34,10 @@ impl<'a> PaneContentsAndUi<'a> { colors, focused_clients, multiple_users_exist_in_session, - mode, } } pub fn render_pane_contents_for_all_clients(&mut self) { - if let Some(vte_output) = self.pane.render() { + if let Some(vte_output) = self.pane.render(None) { // FIXME: Use Termion for cursor and style clearing? self.output.push_str_to_all_clients(&format!( "\u{1b}[{};{}H\u{1b}[m{}", @@ -50,6 +47,20 @@ impl<'a> PaneContentsAndUi<'a> { )); } } + pub fn render_pane_contents_for_client(&mut self, client_id: ClientId) { + if let Some(vte_output) = self.pane.render(Some(client_id)) { + // FIXME: Use Termion for cursor and style clearing? + self.output.push_to_client( + client_id, + &format!( + "\u{1b}[{};{}H\u{1b}[m{}", + self.pane.y() + 1, + self.pane.x() + 1, + vte_output + ), + ); + } + } pub fn render_fake_cursor_if_needed(&mut self, client_id: ClientId) { let pane_focused_for_client_id = self.focused_clients.contains(&client_id); let pane_focused_for_different_client = self @@ -79,7 +90,12 @@ impl<'a> PaneContentsAndUi<'a> { } } } - pub fn render_pane_frame(&mut self, client_id: ClientId, session_is_mirrored: bool) { + pub fn render_pane_frame( + &mut self, + client_id: ClientId, + client_mode: InputMode, + session_is_mirrored: bool, + ) { let pane_focused_for_client_id = self.focused_clients.contains(&client_id); let other_focused_clients: Vec<ClientId> = self .focused_clients @@ -89,7 +105,7 @@ impl<'a> PaneContentsAndUi<'a> { .collect(); let pane_focused_for_differet_client = !other_focused_clients.is_empty(); - let frame_color = self.frame_color(client_id, self.mode, session_is_mirrored); + let frame_color = self.frame_color(client_id, client_mode, session_is_mirrored); let focused_client = if pane_focused_for_client_id { Some(client_id) } else if pane_focused_for_differet_client { @@ -132,10 +148,11 @@ impl<'a> PaneContentsAndUi<'a> { pub fn render_pane_boundaries( &self, client_id: ClientId, + client_mode: InputMode, boundaries: &mut Boundaries, session_is_mirrored: bool, ) { - let color = self.frame_color(client_id, self.mode, session_is_mirrored); + let color = self.frame_color(client_id, client_mode, session_is_mirrored); boundaries.add_rect(self.pane.as_ref(), color); } fn frame_color( |