diff options
| author | denis <denismaximov98@gmail.com> | 2021-03-31 14:32:54 +0300 |
|---|---|---|
| committer | denis <denismaximov98@gmail.com> | 2021-03-31 14:32:54 +0300 |
| commit | b8ee02d4bbb9a8af2fc89bab920fa1a92c2ab9b4 (patch) | |
| tree | 2c59a82d428443b03ce9f0ff105a2531ca3f0d3e /src/client | |
| parent | wip: need to set the default for Palette in the plugins (diff) | |
| parent | fix(plugin): send mode updates to subscribed plugins on load (diff) | |
| download | sl0ppij-b8ee02d4bbb9a8af2fc89bab920fa1a92c2ab9b4.tar.gz sl0ppij-b8ee02d4bbb9a8af2fc89bab920fa1a92c2ab9b4.tar.xz sl0ppij-b8ee02d4bbb9a8af2fc89bab920fa1a92c2ab9b4.zip | |
wip: does it take too long to load colors from xrdb?
Diffstat (limited to 'src/client')
| -rw-r--r-- | src/client/tab.rs | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/src/client/tab.rs b/src/client/tab.rs index 33a25446..4121edba 100644 --- a/src/client/tab.rs +++ b/src/client/tab.rs @@ -14,7 +14,7 @@ use std::{ collections::{BTreeMap, HashSet}, }; use std::{io::Write, sync::mpsc::channel}; -use zellij_tile::data::{Event, InputMode, Palette}; +use zellij_tile::data::{Event, InputMode, ModeInfo, Palette}; const CURSOR_HEIGHT_WIDTH_RATIO: usize = 4; // this is not accurate and kind of a magic number, TODO: look into this const MIN_TERMINAL_HEIGHT: usize = 2; @@ -65,6 +65,7 @@ pub struct Tab { pub send_plugin_instructions: SenderWithContext<PluginInstruction>, pub send_app_instructions: SenderWithContext<AppInstruction>, expansion_boundary: Option<PositionAndSize>, + pub mode_info: ModeInfo, pub input_mode: InputMode, pub colors: Palette, } @@ -183,6 +184,7 @@ impl Tab { send_app_instructions: SenderWithContext<AppInstruction>, max_panes: Option<usize>, pane_id: Option<PaneId>, + mode_info: ModeInfo, input_mode: InputMode, colors: Palette, ) -> Self { @@ -214,6 +216,7 @@ impl Tab { send_pty_instructions, send_plugin_instructions, expansion_boundary: None, + mode_info, input_mode, colors, } @@ -269,6 +272,13 @@ impl Tab { self.send_plugin_instructions.clone(), ); self.panes.insert(PaneId::Plugin(pid), Box::new(new_plugin)); + // Send an initial mode update to the newly loaded plugin only! + self.send_plugin_instructions + .send(PluginInstruction::Update( + Some(pid), + Event::ModeUpdate(self.mode_info.clone()), + )) + .unwrap(); } else { // there are still panes left to fill, use the pids we received in this method let pid = new_pids.next().unwrap(); // if this crashes it means we got less pids than there are panes in this layout @@ -628,10 +638,12 @@ impl Tab { for (kind, terminal) in self.panes.iter_mut() { if !self.panes_to_hide.contains(&terminal.pid()) { match self.active_terminal.unwrap() == terminal.pid() { - true => { - boundaries.add_rect(terminal.as_ref(), self.input_mode, Some(self.colors)) - } - false => boundaries.add_rect(terminal.as_ref(), self.input_mode, None), + true => boundaries.add_rect( + terminal.as_ref(), + self.mode_info.mode, + Some(self.colors), + ), + false => boundaries.add_rect(terminal.as_ref(), self.mode_info.mode, None), } if let Some(vte_output) = terminal.render() { let vte_output = if let PaneId::Terminal(_) = kind { |
