refactor(messaging): reduce extraneous cross-thread messaging (#1996)
* refactor(messaging): reduce extraneous cross-thread messaging * style(fmt): rustfmt
This commit is contained in:
parent
a6f7756296
commit
b1ab4eac10
10 changed files with 758 additions and 969 deletions
|
|
@ -404,11 +404,11 @@ pub fn start_server(mut os_input: Box<dyn ServerOsApi>, socket_path: PathBuf) {
|
||||||
.unwrap();
|
.unwrap();
|
||||||
session_data
|
session_data
|
||||||
.senders
|
.senders
|
||||||
.send_to_plugin(PluginInstruction::Update(
|
.send_to_plugin(PluginInstruction::Update(vec![(
|
||||||
None,
|
None,
|
||||||
Some(client_id),
|
Some(client_id),
|
||||||
Event::ModeUpdate(mode_info),
|
Event::ModeUpdate(mode_info),
|
||||||
))
|
)]))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
send_to_client!(
|
send_to_client!(
|
||||||
client_id,
|
client_id,
|
||||||
|
|
|
||||||
|
|
@ -378,20 +378,20 @@ impl Pane for PluginPane {
|
||||||
}
|
}
|
||||||
fn scroll_up(&mut self, count: usize, client_id: ClientId) {
|
fn scroll_up(&mut self, count: usize, client_id: ClientId) {
|
||||||
self.send_plugin_instructions
|
self.send_plugin_instructions
|
||||||
.send(PluginInstruction::Update(
|
.send(PluginInstruction::Update(vec![(
|
||||||
Some(self.pid),
|
Some(self.pid),
|
||||||
Some(client_id),
|
Some(client_id),
|
||||||
Event::Mouse(Mouse::ScrollUp(count)),
|
Event::Mouse(Mouse::ScrollUp(count)),
|
||||||
))
|
)]))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
}
|
}
|
||||||
fn scroll_down(&mut self, count: usize, client_id: ClientId) {
|
fn scroll_down(&mut self, count: usize, client_id: ClientId) {
|
||||||
self.send_plugin_instructions
|
self.send_plugin_instructions
|
||||||
.send(PluginInstruction::Update(
|
.send(PluginInstruction::Update(vec![(
|
||||||
Some(self.pid),
|
Some(self.pid),
|
||||||
Some(client_id),
|
Some(client_id),
|
||||||
Event::Mouse(Mouse::ScrollDown(count)),
|
Event::Mouse(Mouse::ScrollDown(count)),
|
||||||
))
|
)]))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
}
|
}
|
||||||
fn clear_scroll(&mut self) {
|
fn clear_scroll(&mut self) {
|
||||||
|
|
@ -399,29 +399,29 @@ impl Pane for PluginPane {
|
||||||
}
|
}
|
||||||
fn start_selection(&mut self, start: &Position, client_id: ClientId) {
|
fn start_selection(&mut self, start: &Position, client_id: ClientId) {
|
||||||
self.send_plugin_instructions
|
self.send_plugin_instructions
|
||||||
.send(PluginInstruction::Update(
|
.send(PluginInstruction::Update(vec![(
|
||||||
Some(self.pid),
|
Some(self.pid),
|
||||||
Some(client_id),
|
Some(client_id),
|
||||||
Event::Mouse(Mouse::LeftClick(start.line.0, start.column.0)),
|
Event::Mouse(Mouse::LeftClick(start.line.0, start.column.0)),
|
||||||
))
|
)]))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
}
|
}
|
||||||
fn update_selection(&mut self, position: &Position, client_id: ClientId) {
|
fn update_selection(&mut self, position: &Position, client_id: ClientId) {
|
||||||
self.send_plugin_instructions
|
self.send_plugin_instructions
|
||||||
.send(PluginInstruction::Update(
|
.send(PluginInstruction::Update(vec![(
|
||||||
Some(self.pid),
|
Some(self.pid),
|
||||||
Some(client_id),
|
Some(client_id),
|
||||||
Event::Mouse(Mouse::Hold(position.line.0, position.column.0)),
|
Event::Mouse(Mouse::Hold(position.line.0, position.column.0)),
|
||||||
))
|
)]))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
}
|
}
|
||||||
fn end_selection(&mut self, end: &Position, client_id: ClientId) {
|
fn end_selection(&mut self, end: &Position, client_id: ClientId) {
|
||||||
self.send_plugin_instructions
|
self.send_plugin_instructions
|
||||||
.send(PluginInstruction::Update(
|
.send(PluginInstruction::Update(vec![(
|
||||||
Some(self.pid),
|
Some(self.pid),
|
||||||
Some(client_id),
|
Some(client_id),
|
||||||
Event::Mouse(Mouse::Release(end.line(), end.column())),
|
Event::Mouse(Mouse::Release(end.line(), end.column())),
|
||||||
))
|
)]))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
}
|
}
|
||||||
fn is_scrolled(&self) -> bool {
|
fn is_scrolled(&self) -> bool {
|
||||||
|
|
@ -462,11 +462,11 @@ impl Pane for PluginPane {
|
||||||
}
|
}
|
||||||
fn handle_right_click(&mut self, to: &Position, client_id: ClientId) {
|
fn handle_right_click(&mut self, to: &Position, client_id: ClientId) {
|
||||||
self.send_plugin_instructions
|
self.send_plugin_instructions
|
||||||
.send(PluginInstruction::Update(
|
.send(PluginInstruction::Update(vec![(
|
||||||
Some(self.pid),
|
Some(self.pid),
|
||||||
Some(client_id),
|
Some(client_id),
|
||||||
Event::Mouse(Mouse::RightClick(to.line.0, to.column.0)),
|
Event::Mouse(Mouse::RightClick(to.line.0, to.column.0)),
|
||||||
))
|
)]))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ use zellij_utils::{
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub enum PluginInstruction {
|
pub enum PluginInstruction {
|
||||||
Load(RunPlugin, usize, ClientId, Size), // plugin metadata, tab_index, client_ids
|
Load(RunPlugin, usize, ClientId, Size), // plugin metadata, tab_index, client_ids
|
||||||
Update(Option<u32>, Option<ClientId>, Event), // Focused plugin / broadcast, client_id, event data
|
Update(Vec<(Option<u32>, Option<ClientId>, Event)>), // Focused plugin / broadcast, client_id, event data
|
||||||
Unload(u32), // plugin_id
|
Unload(u32), // plugin_id
|
||||||
Resize(u32, usize, usize), // plugin_id, columns, rows
|
Resize(u32, usize, usize), // plugin_id, columns, rows
|
||||||
AddClient(ClientId),
|
AddClient(ClientId),
|
||||||
|
|
@ -73,8 +73,8 @@ pub(crate) fn plugin_thread_main(
|
||||||
PluginInstruction::Load(run, tab_index, client_id, size) => {
|
PluginInstruction::Load(run, tab_index, client_id, size) => {
|
||||||
wasm_bridge.load_plugin(&run, tab_index, size, client_id)?;
|
wasm_bridge.load_plugin(&run, tab_index, size, client_id)?;
|
||||||
},
|
},
|
||||||
PluginInstruction::Update(pid, cid, event) => {
|
PluginInstruction::Update(updates) => {
|
||||||
wasm_bridge.update_plugins(pid, cid, event)?;
|
wasm_bridge.update_plugins(updates)?;
|
||||||
},
|
},
|
||||||
PluginInstruction::Unload(pid) => {
|
PluginInstruction::Unload(pid) => {
|
||||||
wasm_bridge.unload_plugin(pid)?;
|
wasm_bridge.unload_plugin(pid)?;
|
||||||
|
|
|
||||||
|
|
@ -398,6 +398,7 @@ impl WasmBridge {
|
||||||
}
|
}
|
||||||
pub fn resize_plugin(&mut self, pid: u32, new_columns: usize, new_rows: usize) -> Result<()> {
|
pub fn resize_plugin(&mut self, pid: u32, new_columns: usize, new_rows: usize) -> Result<()> {
|
||||||
let err_context = || format!("failed to resize plugin {pid}");
|
let err_context = || format!("failed to resize plugin {pid}");
|
||||||
|
let mut plugin_bytes = vec![];
|
||||||
for ((plugin_id, client_id), (instance, plugin_env, (current_rows, current_columns))) in
|
for ((plugin_id, client_id), (instance, plugin_env, (current_rows, current_columns))) in
|
||||||
self.plugin_map.iter_mut()
|
self.plugin_map.iter_mut()
|
||||||
{
|
{
|
||||||
|
|
@ -418,37 +419,39 @@ impl WasmBridge {
|
||||||
])
|
])
|
||||||
.with_context(err_context)?;
|
.with_context(err_context)?;
|
||||||
let rendered_bytes = wasi_read_string(&plugin_env.wasi_env);
|
let rendered_bytes = wasi_read_string(&plugin_env.wasi_env);
|
||||||
drop(self.senders.send_to_screen(ScreenInstruction::PluginBytes(
|
plugin_bytes.push((*plugin_id, *client_id, rendered_bytes.as_bytes().to_vec()));
|
||||||
*plugin_id,
|
|
||||||
*client_id,
|
|
||||||
rendered_bytes.as_bytes().to_vec(),
|
|
||||||
)));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
let _ = self
|
||||||
|
.senders
|
||||||
|
.send_to_screen(ScreenInstruction::PluginBytes(plugin_bytes));
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
pub fn update_plugins(
|
pub fn update_plugins(
|
||||||
&mut self,
|
&mut self,
|
||||||
pid: Option<u32>,
|
mut updates: Vec<(Option<u32>, Option<ClientId>, Event)>,
|
||||||
cid: Option<ClientId>,
|
|
||||||
event: Event,
|
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
let err_context = || {
|
let err_context = || {
|
||||||
if *DEBUG_MODE.get().unwrap_or(&true) {
|
if *DEBUG_MODE.get().unwrap_or(&true) {
|
||||||
format!("failed to update plugin state with event: {event:#?}")
|
format!("failed to update plugin state")
|
||||||
} else {
|
} else {
|
||||||
"failed to update plugin state".to_string()
|
"failed to update plugin state".to_string()
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
for (&(plugin_id, client_id), (instance, plugin_env, (rows, columns))) in &self.plugin_map {
|
let mut plugin_bytes = vec![];
|
||||||
|
for (pid, cid, event) in updates.drain(..) {
|
||||||
|
for (&(plugin_id, client_id), (instance, plugin_env, (rows, columns))) in
|
||||||
|
&self.plugin_map
|
||||||
|
{
|
||||||
let subs = plugin_env
|
let subs = plugin_env
|
||||||
.subscriptions
|
.subscriptions
|
||||||
.lock()
|
.lock()
|
||||||
.to_anyhow()
|
.to_anyhow()
|
||||||
.with_context(err_context)?;
|
.with_context(err_context)?;
|
||||||
// FIXME: This is very janky... Maybe I should write my own macro for Event -> EventType?
|
// FIXME: This is very janky... Maybe I should write my own macro for Event -> EventType?
|
||||||
let event_type = EventType::from_str(&event.to_string()).with_context(err_context)?;
|
let event_type =
|
||||||
|
EventType::from_str(&event.to_string()).with_context(err_context)?;
|
||||||
if subs.contains(&event_type)
|
if subs.contains(&event_type)
|
||||||
&& ((pid.is_none() && cid.is_none())
|
&& ((pid.is_none() && cid.is_none())
|
||||||
|| (pid.is_none() && cid == Some(client_id))
|
|| (pid.is_none() && cid == Some(client_id))
|
||||||
|
|
@ -488,14 +491,18 @@ impl WasmBridge {
|
||||||
.call(&[Value::I32(*rows as i32), Value::I32(*columns as i32)])
|
.call(&[Value::I32(*rows as i32), Value::I32(*columns as i32)])
|
||||||
.with_context(err_context)?;
|
.with_context(err_context)?;
|
||||||
let rendered_bytes = wasi_read_string(&plugin_env.wasi_env);
|
let rendered_bytes = wasi_read_string(&plugin_env.wasi_env);
|
||||||
drop(self.senders.send_to_screen(ScreenInstruction::PluginBytes(
|
plugin_bytes.push((
|
||||||
plugin_id,
|
plugin_id,
|
||||||
client_id,
|
client_id,
|
||||||
rendered_bytes.as_bytes().to_vec(),
|
rendered_bytes.as_bytes().to_vec(),
|
||||||
)));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
let _ = self
|
||||||
|
.senders
|
||||||
|
.send_to_screen(ScreenInstruction::PluginBytes(plugin_bytes));
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
pub fn remove_client(&mut self, client_id: ClientId) {
|
pub fn remove_client(&mut self, client_id: ClientId) {
|
||||||
|
|
@ -673,11 +680,11 @@ fn host_set_timeout(plugin_env: &PluginEnv, secs: f64) {
|
||||||
|
|
||||||
send_plugin_instructions
|
send_plugin_instructions
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.send(PluginInstruction::Update(
|
.send(PluginInstruction::Update(vec![(
|
||||||
update_target,
|
update_target,
|
||||||
Some(client_id),
|
Some(client_id),
|
||||||
Event::Timer(elapsed_time),
|
Event::Timer(elapsed_time),
|
||||||
))
|
)]))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -39,11 +39,11 @@ pub(crate) fn route_action(
|
||||||
_ => {
|
_ => {
|
||||||
session
|
session
|
||||||
.senders
|
.senders
|
||||||
.send_to_plugin(PluginInstruction::Update(
|
.send_to_plugin(PluginInstruction::Update(vec![(
|
||||||
None,
|
None,
|
||||||
Some(client_id),
|
Some(client_id),
|
||||||
Event::InputReceived,
|
Event::InputReceived,
|
||||||
))
|
)]))
|
||||||
.with_context(err_context)?;
|
.with_context(err_context)?;
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
@ -84,11 +84,11 @@ pub(crate) fn route_action(
|
||||||
// TODO: Need access to `ClientAttributes` here
|
// TODO: Need access to `ClientAttributes` here
|
||||||
session
|
session
|
||||||
.senders
|
.senders
|
||||||
.send_to_plugin(PluginInstruction::Update(
|
.send_to_plugin(PluginInstruction::Update(vec![(
|
||||||
None,
|
None,
|
||||||
Some(client_id),
|
Some(client_id),
|
||||||
Event::ModeUpdate(get_mode_info(mode, attrs, session.capabilities)),
|
Event::ModeUpdate(get_mode_info(mode, attrs, session.capabilities)),
|
||||||
))
|
)]))
|
||||||
.with_context(err_context)?;
|
.with_context(err_context)?;
|
||||||
session
|
session
|
||||||
.senders
|
.senders
|
||||||
|
|
@ -314,11 +314,11 @@ pub(crate) fn route_action(
|
||||||
let attrs = &session.client_attributes;
|
let attrs = &session.client_attributes;
|
||||||
session
|
session
|
||||||
.senders
|
.senders
|
||||||
.send_to_plugin(PluginInstruction::Update(
|
.send_to_plugin(PluginInstruction::Update(vec![(
|
||||||
None,
|
None,
|
||||||
None,
|
None,
|
||||||
Event::ModeUpdate(get_mode_info(input_mode, attrs, session.capabilities)),
|
Event::ModeUpdate(get_mode_info(input_mode, attrs, session.capabilities)),
|
||||||
))
|
)]))
|
||||||
.with_context(err_context)?;
|
.with_context(err_context)?;
|
||||||
session
|
session
|
||||||
.senders
|
.senders
|
||||||
|
|
|
||||||
|
|
@ -122,7 +122,7 @@ type HoldForCommand = Option<RunCommand>;
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub enum ScreenInstruction {
|
pub enum ScreenInstruction {
|
||||||
PtyBytes(u32, VteBytes),
|
PtyBytes(u32, VteBytes),
|
||||||
PluginBytes(u32, ClientId, VteBytes), // u32 is plugin_id
|
PluginBytes(Vec<(u32, ClientId, VteBytes)>), // u32 is plugin_id
|
||||||
Render,
|
Render,
|
||||||
NewPane(
|
NewPane(
|
||||||
PaneId,
|
PaneId,
|
||||||
|
|
@ -1019,6 +1019,7 @@ impl Screen {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn update_tabs(&self) -> Result<()> {
|
pub fn update_tabs(&self) -> Result<()> {
|
||||||
|
let mut plugin_updates = vec![];
|
||||||
for (client_id, active_tab_index) in self.active_tab_indices.iter() {
|
for (client_id, active_tab_index) in self.active_tab_indices.iter() {
|
||||||
let mut tab_data = vec![];
|
let mut tab_data = vec![];
|
||||||
for tab in self.tabs.values() {
|
for tab in self.tabs.values() {
|
||||||
|
|
@ -1045,15 +1046,12 @@ impl Screen {
|
||||||
other_focused_clients,
|
other_focused_clients,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
plugin_updates.push((None, Some(*client_id), Event::TabUpdate(tab_data)));
|
||||||
|
}
|
||||||
self.bus
|
self.bus
|
||||||
.senders
|
.senders
|
||||||
.send_to_plugin(PluginInstruction::Update(
|
.send_to_plugin(PluginInstruction::Update(plugin_updates))
|
||||||
None,
|
|
||||||
Some(*client_id),
|
|
||||||
Event::TabUpdate(tab_data),
|
|
||||||
))
|
|
||||||
.context("failed to update tabs")?;
|
.context("failed to update tabs")?;
|
||||||
}
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1328,7 +1326,8 @@ pub(crate) fn screen_thread_main(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
ScreenInstruction::PluginBytes(pid, client_id, vte_bytes) => {
|
ScreenInstruction::PluginBytes(mut plugin_bytes) => {
|
||||||
|
for (pid, client_id, vte_bytes) in plugin_bytes.drain(..) {
|
||||||
let all_tabs = screen.get_tabs_mut();
|
let all_tabs = screen.get_tabs_mut();
|
||||||
for tab in all_tabs.values_mut() {
|
for tab in all_tabs.values_mut() {
|
||||||
if tab.has_plugin(pid) {
|
if tab.has_plugin(pid) {
|
||||||
|
|
@ -1337,6 +1336,7 @@ pub(crate) fn screen_thread_main(
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
screen.render()?;
|
screen.render()?;
|
||||||
},
|
},
|
||||||
ScreenInstruction::Render => {
|
ScreenInstruction::Render => {
|
||||||
|
|
|
||||||
|
|
@ -683,21 +683,14 @@ impl Tab {
|
||||||
pub fn update_input_modes(&mut self) -> Result<()> {
|
pub fn update_input_modes(&mut self) -> Result<()> {
|
||||||
// this updates all plugins with the client's input mode
|
// this updates all plugins with the client's input mode
|
||||||
let mode_infos = self.mode_info.borrow();
|
let mode_infos = self.mode_info.borrow();
|
||||||
|
let mut plugin_updates = vec![];
|
||||||
for client_id in self.connected_clients.borrow().iter() {
|
for client_id in self.connected_clients.borrow().iter() {
|
||||||
let mode_info = mode_infos.get(client_id).unwrap_or(&self.default_mode_info);
|
let mode_info = mode_infos.get(client_id).unwrap_or(&self.default_mode_info);
|
||||||
self.senders
|
plugin_updates.push((None, Some(*client_id), Event::ModeUpdate(mode_info.clone())));
|
||||||
.send_to_plugin(PluginInstruction::Update(
|
|
||||||
None,
|
|
||||||
Some(*client_id),
|
|
||||||
Event::ModeUpdate(mode_info.clone()),
|
|
||||||
))
|
|
||||||
.with_context(|| {
|
|
||||||
format!(
|
|
||||||
"failed to update plugins with mode info {:?}",
|
|
||||||
mode_info.mode
|
|
||||||
)
|
|
||||||
})?;
|
|
||||||
}
|
}
|
||||||
|
self.senders
|
||||||
|
.send_to_plugin(PluginInstruction::Update(plugin_updates))
|
||||||
|
.with_context(|| format!("failed to update plugins with mode info"))?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
pub fn add_client(&mut self, client_id: ClientId, mode_info: Option<ModeInfo>) -> Result<()> {
|
pub fn add_client(&mut self, client_id: ClientId, mode_info: Option<ModeInfo>) -> Result<()> {
|
||||||
|
|
@ -742,8 +735,7 @@ impl Tab {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
self.set_force_render();
|
self.set_force_render();
|
||||||
self.update_input_modes()
|
Ok(())
|
||||||
.with_context(|| format!("failed to add client {client_id} to tab"))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn change_mode_info(&mut self, mode_info: ModeInfo, client_id: ClientId) {
|
pub fn change_mode_info(&mut self, mode_info: ModeInfo, client_id: ClientId) {
|
||||||
|
|
@ -1357,11 +1349,13 @@ impl Tab {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
PaneId::Plugin(pid) => {
|
PaneId::Plugin(pid) => {
|
||||||
|
let mut plugin_updates = vec![];
|
||||||
for key in parse_keys(&input_bytes) {
|
for key in parse_keys(&input_bytes) {
|
||||||
self.senders
|
plugin_updates.push((Some(pid), None, Event::Key(key)));
|
||||||
.send_to_plugin(PluginInstruction::Update(Some(pid), None, Event::Key(key)))
|
|
||||||
.with_context(err_context)?;
|
|
||||||
}
|
}
|
||||||
|
self.senders
|
||||||
|
.send_to_plugin(PluginInstruction::Update(plugin_updates))
|
||||||
|
.with_context(err_context)?;
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
Ok(should_update_ui)
|
Ok(should_update_ui)
|
||||||
|
|
@ -2633,11 +2627,11 @@ impl Tab {
|
||||||
format!("failed to write selection to clipboard for client {client_id}")
|
format!("failed to write selection to clipboard for client {client_id}")
|
||||||
})?;
|
})?;
|
||||||
self.senders
|
self.senders
|
||||||
.send_to_plugin(PluginInstruction::Update(
|
.send_to_plugin(PluginInstruction::Update(vec![(
|
||||||
None,
|
None,
|
||||||
None,
|
None,
|
||||||
Event::CopyToClipboard(self.clipboard_provider.as_copy_destination()),
|
Event::CopyToClipboard(self.clipboard_provider.as_copy_destination()),
|
||||||
))
|
)]))
|
||||||
.with_context(|| {
|
.with_context(|| {
|
||||||
format!("failed to inform plugins about copy selection for client {client_id}")
|
format!("failed to inform plugins about copy selection for client {client_id}")
|
||||||
})
|
})
|
||||||
|
|
@ -2677,7 +2671,11 @@ impl Tab {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
self.senders
|
self.senders
|
||||||
.send_to_plugin(PluginInstruction::Update(None, None, clipboard_event))
|
.send_to_plugin(PluginInstruction::Update(vec![(
|
||||||
|
None,
|
||||||
|
None,
|
||||||
|
clipboard_event,
|
||||||
|
)]))
|
||||||
.context("failed to notify plugins about new clipboard event")
|
.context("failed to notify plugins about new clipboard event")
|
||||||
.non_fatal();
|
.non_fatal();
|
||||||
|
|
||||||
|
|
@ -2712,15 +2710,13 @@ impl Tab {
|
||||||
PaneId::Plugin(pid) => Some(pid),
|
PaneId::Plugin(pid) => Some(pid),
|
||||||
_ => None,
|
_ => None,
|
||||||
});
|
});
|
||||||
|
let mut plugin_updates = vec![];
|
||||||
for pid in pids_in_this_tab {
|
for pid in pids_in_this_tab {
|
||||||
self.senders
|
plugin_updates.push((Some(*pid), None, Event::Visible(visible)));
|
||||||
.send_to_plugin(PluginInstruction::Update(
|
|
||||||
Some(*pid),
|
|
||||||
None,
|
|
||||||
Event::Visible(visible),
|
|
||||||
))
|
|
||||||
.with_context(|| format!("failed to set visibility of tab to {visible}"))?;
|
|
||||||
}
|
}
|
||||||
|
self.senders
|
||||||
|
.send_to_plugin(PluginInstruction::Update(plugin_updates))
|
||||||
|
.with_context(|| format!("failed to set visibility of tab to {visible}"))?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
---
|
---
|
||||||
source: zellij-server/src/./unit/screen_tests.rs
|
source: zellij-server/src/./unit/screen_tests.rs
|
||||||
assertion_line: 2346
|
assertion_line: 2366
|
||||||
expression: "format!(\"{}\", snapshot)"
|
expression: "format!(\"{}\", snapshot)"
|
||||||
---
|
---
|
||||||
00 (C): ┌ Pane #1 ─────────────────────────────────────────────────────────────────────┐
|
00 (C): ┌ Pane #1 ─────────────────────────────────────────────────────────────────────┐
|
||||||
|
|
|
||||||
|
|
@ -1,23 +1,31 @@
|
||||||
---
|
---
|
||||||
source: zellij-server/src/./unit/screen_tests.rs
|
source: zellij-server/src/./unit/screen_tests.rs
|
||||||
assertion_line: 2506
|
assertion_line: 2511
|
||||||
expression: "format!(\"{:#?}\", * received_plugin_instructions.lock().unwrap())"
|
expression: "format!(\"{:#?}\", * received_plugin_instructions.lock().unwrap())"
|
||||||
---
|
---
|
||||||
[
|
[
|
||||||
Update(
|
Update(
|
||||||
|
[
|
||||||
|
(
|
||||||
None,
|
None,
|
||||||
Some(
|
Some(
|
||||||
10,
|
10,
|
||||||
),
|
),
|
||||||
InputReceived,
|
InputReceived,
|
||||||
),
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
Update(
|
Update(
|
||||||
|
[
|
||||||
|
(
|
||||||
None,
|
None,
|
||||||
Some(
|
Some(
|
||||||
10,
|
10,
|
||||||
),
|
),
|
||||||
InputReceived,
|
InputReceived,
|
||||||
),
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
NewTab(
|
NewTab(
|
||||||
None,
|
None,
|
||||||
Some(
|
Some(
|
||||||
|
|
@ -58,6 +66,8 @@ expression: "format!(\"{:#?}\", * received_plugin_instructions.lock().unwrap())"
|
||||||
1,
|
1,
|
||||||
),
|
),
|
||||||
Update(
|
Update(
|
||||||
|
[
|
||||||
|
(
|
||||||
None,
|
None,
|
||||||
Some(
|
Some(
|
||||||
1,
|
1,
|
||||||
|
|
@ -133,83 +143,14 @@ expression: "format!(\"{:#?}\", * received_plugin_instructions.lock().unwrap())"
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Update(
|
],
|
||||||
None,
|
|
||||||
Some(
|
|
||||||
1,
|
|
||||||
),
|
|
||||||
ModeUpdate(
|
|
||||||
ModeInfo {
|
|
||||||
mode: Normal,
|
|
||||||
keybinds: [],
|
|
||||||
style: Style {
|
|
||||||
colors: Palette {
|
|
||||||
source: Default,
|
|
||||||
theme_hue: Dark,
|
|
||||||
fg: EightBit(
|
|
||||||
0,
|
|
||||||
),
|
|
||||||
bg: EightBit(
|
|
||||||
0,
|
|
||||||
),
|
|
||||||
black: EightBit(
|
|
||||||
0,
|
|
||||||
),
|
|
||||||
red: EightBit(
|
|
||||||
0,
|
|
||||||
),
|
|
||||||
green: EightBit(
|
|
||||||
0,
|
|
||||||
),
|
|
||||||
yellow: EightBit(
|
|
||||||
0,
|
|
||||||
),
|
|
||||||
blue: EightBit(
|
|
||||||
0,
|
|
||||||
),
|
|
||||||
magenta: EightBit(
|
|
||||||
0,
|
|
||||||
),
|
|
||||||
cyan: EightBit(
|
|
||||||
0,
|
|
||||||
),
|
|
||||||
white: EightBit(
|
|
||||||
0,
|
|
||||||
),
|
|
||||||
orange: EightBit(
|
|
||||||
0,
|
|
||||||
),
|
|
||||||
gray: EightBit(
|
|
||||||
0,
|
|
||||||
),
|
|
||||||
purple: EightBit(
|
|
||||||
0,
|
|
||||||
),
|
|
||||||
gold: EightBit(
|
|
||||||
0,
|
|
||||||
),
|
|
||||||
silver: EightBit(
|
|
||||||
0,
|
|
||||||
),
|
|
||||||
pink: EightBit(
|
|
||||||
0,
|
|
||||||
),
|
|
||||||
brown: EightBit(
|
|
||||||
0,
|
|
||||||
),
|
|
||||||
},
|
|
||||||
rounded_corners: false,
|
|
||||||
},
|
|
||||||
capabilities: PluginCapabilities {
|
|
||||||
arrow_fonts: false,
|
|
||||||
},
|
|
||||||
session_name: Some(
|
|
||||||
"zellij-test",
|
|
||||||
),
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
Update(
|
Update(
|
||||||
|
[],
|
||||||
|
),
|
||||||
|
Update(
|
||||||
|
[
|
||||||
|
(
|
||||||
None,
|
None,
|
||||||
Some(
|
Some(
|
||||||
1,
|
1,
|
||||||
|
|
@ -229,6 +170,8 @@ expression: "format!(\"{:#?}\", * received_plugin_instructions.lock().unwrap())"
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
NewTab(
|
NewTab(
|
||||||
None,
|
None,
|
||||||
Some(
|
Some(
|
||||||
|
|
@ -269,6 +212,11 @@ expression: "format!(\"{:#?}\", * received_plugin_instructions.lock().unwrap())"
|
||||||
1,
|
1,
|
||||||
),
|
),
|
||||||
Update(
|
Update(
|
||||||
|
[],
|
||||||
|
),
|
||||||
|
Update(
|
||||||
|
[
|
||||||
|
(
|
||||||
None,
|
None,
|
||||||
Some(
|
Some(
|
||||||
1,
|
1,
|
||||||
|
|
@ -344,83 +292,14 @@ expression: "format!(\"{:#?}\", * received_plugin_instructions.lock().unwrap())"
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Update(
|
],
|
||||||
None,
|
|
||||||
Some(
|
|
||||||
1,
|
|
||||||
),
|
|
||||||
ModeUpdate(
|
|
||||||
ModeInfo {
|
|
||||||
mode: Normal,
|
|
||||||
keybinds: [],
|
|
||||||
style: Style {
|
|
||||||
colors: Palette {
|
|
||||||
source: Default,
|
|
||||||
theme_hue: Dark,
|
|
||||||
fg: EightBit(
|
|
||||||
0,
|
|
||||||
),
|
|
||||||
bg: EightBit(
|
|
||||||
0,
|
|
||||||
),
|
|
||||||
black: EightBit(
|
|
||||||
0,
|
|
||||||
),
|
|
||||||
red: EightBit(
|
|
||||||
0,
|
|
||||||
),
|
|
||||||
green: EightBit(
|
|
||||||
0,
|
|
||||||
),
|
|
||||||
yellow: EightBit(
|
|
||||||
0,
|
|
||||||
),
|
|
||||||
blue: EightBit(
|
|
||||||
0,
|
|
||||||
),
|
|
||||||
magenta: EightBit(
|
|
||||||
0,
|
|
||||||
),
|
|
||||||
cyan: EightBit(
|
|
||||||
0,
|
|
||||||
),
|
|
||||||
white: EightBit(
|
|
||||||
0,
|
|
||||||
),
|
|
||||||
orange: EightBit(
|
|
||||||
0,
|
|
||||||
),
|
|
||||||
gray: EightBit(
|
|
||||||
0,
|
|
||||||
),
|
|
||||||
purple: EightBit(
|
|
||||||
0,
|
|
||||||
),
|
|
||||||
gold: EightBit(
|
|
||||||
0,
|
|
||||||
),
|
|
||||||
silver: EightBit(
|
|
||||||
0,
|
|
||||||
),
|
|
||||||
pink: EightBit(
|
|
||||||
0,
|
|
||||||
),
|
|
||||||
brown: EightBit(
|
|
||||||
0,
|
|
||||||
),
|
|
||||||
},
|
|
||||||
rounded_corners: false,
|
|
||||||
},
|
|
||||||
capabilities: PluginCapabilities {
|
|
||||||
arrow_fonts: false,
|
|
||||||
},
|
|
||||||
session_name: Some(
|
|
||||||
"zellij-test",
|
|
||||||
),
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
Update(
|
Update(
|
||||||
|
[],
|
||||||
|
),
|
||||||
|
Update(
|
||||||
|
[
|
||||||
|
(
|
||||||
None,
|
None,
|
||||||
Some(
|
Some(
|
||||||
1,
|
1,
|
||||||
|
|
@ -450,7 +329,11 @@ expression: "format!(\"{:#?}\", * received_plugin_instructions.lock().unwrap())"
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
Update(
|
Update(
|
||||||
|
[
|
||||||
|
(
|
||||||
None,
|
None,
|
||||||
Some(
|
Some(
|
||||||
1,
|
1,
|
||||||
|
|
@ -480,7 +363,11 @@ expression: "format!(\"{:#?}\", * received_plugin_instructions.lock().unwrap())"
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
Update(
|
Update(
|
||||||
|
[
|
||||||
|
(
|
||||||
None,
|
None,
|
||||||
Some(
|
Some(
|
||||||
1,
|
1,
|
||||||
|
|
@ -510,5 +397,7 @@ expression: "format!(\"{:#?}\", * received_plugin_instructions.lock().unwrap())"
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
Exit,
|
Exit,
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -1,23 +1,31 @@
|
||||||
---
|
---
|
||||||
source: zellij-server/src/./unit/screen_tests.rs
|
source: zellij-server/src/./unit/screen_tests.rs
|
||||||
assertion_line: 2549
|
assertion_line: 2554
|
||||||
expression: "format!(\"{:#?}\", * received_plugin_instructions.lock().unwrap())"
|
expression: "format!(\"{:#?}\", * received_plugin_instructions.lock().unwrap())"
|
||||||
---
|
---
|
||||||
[
|
[
|
||||||
Update(
|
Update(
|
||||||
|
[
|
||||||
|
(
|
||||||
None,
|
None,
|
||||||
Some(
|
Some(
|
||||||
10,
|
10,
|
||||||
),
|
),
|
||||||
InputReceived,
|
InputReceived,
|
||||||
),
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
Update(
|
Update(
|
||||||
|
[
|
||||||
|
(
|
||||||
None,
|
None,
|
||||||
Some(
|
Some(
|
||||||
10,
|
10,
|
||||||
),
|
),
|
||||||
InputReceived,
|
InputReceived,
|
||||||
),
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
NewTab(
|
NewTab(
|
||||||
None,
|
None,
|
||||||
Some(
|
Some(
|
||||||
|
|
@ -58,6 +66,8 @@ expression: "format!(\"{:#?}\", * received_plugin_instructions.lock().unwrap())"
|
||||||
1,
|
1,
|
||||||
),
|
),
|
||||||
Update(
|
Update(
|
||||||
|
[
|
||||||
|
(
|
||||||
None,
|
None,
|
||||||
Some(
|
Some(
|
||||||
1,
|
1,
|
||||||
|
|
@ -133,83 +143,14 @@ expression: "format!(\"{:#?}\", * received_plugin_instructions.lock().unwrap())"
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Update(
|
],
|
||||||
None,
|
|
||||||
Some(
|
|
||||||
1,
|
|
||||||
),
|
|
||||||
ModeUpdate(
|
|
||||||
ModeInfo {
|
|
||||||
mode: Normal,
|
|
||||||
keybinds: [],
|
|
||||||
style: Style {
|
|
||||||
colors: Palette {
|
|
||||||
source: Default,
|
|
||||||
theme_hue: Dark,
|
|
||||||
fg: EightBit(
|
|
||||||
0,
|
|
||||||
),
|
|
||||||
bg: EightBit(
|
|
||||||
0,
|
|
||||||
),
|
|
||||||
black: EightBit(
|
|
||||||
0,
|
|
||||||
),
|
|
||||||
red: EightBit(
|
|
||||||
0,
|
|
||||||
),
|
|
||||||
green: EightBit(
|
|
||||||
0,
|
|
||||||
),
|
|
||||||
yellow: EightBit(
|
|
||||||
0,
|
|
||||||
),
|
|
||||||
blue: EightBit(
|
|
||||||
0,
|
|
||||||
),
|
|
||||||
magenta: EightBit(
|
|
||||||
0,
|
|
||||||
),
|
|
||||||
cyan: EightBit(
|
|
||||||
0,
|
|
||||||
),
|
|
||||||
white: EightBit(
|
|
||||||
0,
|
|
||||||
),
|
|
||||||
orange: EightBit(
|
|
||||||
0,
|
|
||||||
),
|
|
||||||
gray: EightBit(
|
|
||||||
0,
|
|
||||||
),
|
|
||||||
purple: EightBit(
|
|
||||||
0,
|
|
||||||
),
|
|
||||||
gold: EightBit(
|
|
||||||
0,
|
|
||||||
),
|
|
||||||
silver: EightBit(
|
|
||||||
0,
|
|
||||||
),
|
|
||||||
pink: EightBit(
|
|
||||||
0,
|
|
||||||
),
|
|
||||||
brown: EightBit(
|
|
||||||
0,
|
|
||||||
),
|
|
||||||
},
|
|
||||||
rounded_corners: false,
|
|
||||||
},
|
|
||||||
capabilities: PluginCapabilities {
|
|
||||||
arrow_fonts: false,
|
|
||||||
},
|
|
||||||
session_name: Some(
|
|
||||||
"zellij-test",
|
|
||||||
),
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
Update(
|
Update(
|
||||||
|
[],
|
||||||
|
),
|
||||||
|
Update(
|
||||||
|
[
|
||||||
|
(
|
||||||
None,
|
None,
|
||||||
Some(
|
Some(
|
||||||
1,
|
1,
|
||||||
|
|
@ -229,6 +170,8 @@ expression: "format!(\"{:#?}\", * received_plugin_instructions.lock().unwrap())"
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
NewTab(
|
NewTab(
|
||||||
None,
|
None,
|
||||||
Some(
|
Some(
|
||||||
|
|
@ -269,6 +212,11 @@ expression: "format!(\"{:#?}\", * received_plugin_instructions.lock().unwrap())"
|
||||||
1,
|
1,
|
||||||
),
|
),
|
||||||
Update(
|
Update(
|
||||||
|
[],
|
||||||
|
),
|
||||||
|
Update(
|
||||||
|
[
|
||||||
|
(
|
||||||
None,
|
None,
|
||||||
Some(
|
Some(
|
||||||
1,
|
1,
|
||||||
|
|
@ -344,83 +292,14 @@ expression: "format!(\"{:#?}\", * received_plugin_instructions.lock().unwrap())"
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Update(
|
],
|
||||||
None,
|
|
||||||
Some(
|
|
||||||
1,
|
|
||||||
),
|
|
||||||
ModeUpdate(
|
|
||||||
ModeInfo {
|
|
||||||
mode: Normal,
|
|
||||||
keybinds: [],
|
|
||||||
style: Style {
|
|
||||||
colors: Palette {
|
|
||||||
source: Default,
|
|
||||||
theme_hue: Dark,
|
|
||||||
fg: EightBit(
|
|
||||||
0,
|
|
||||||
),
|
|
||||||
bg: EightBit(
|
|
||||||
0,
|
|
||||||
),
|
|
||||||
black: EightBit(
|
|
||||||
0,
|
|
||||||
),
|
|
||||||
red: EightBit(
|
|
||||||
0,
|
|
||||||
),
|
|
||||||
green: EightBit(
|
|
||||||
0,
|
|
||||||
),
|
|
||||||
yellow: EightBit(
|
|
||||||
0,
|
|
||||||
),
|
|
||||||
blue: EightBit(
|
|
||||||
0,
|
|
||||||
),
|
|
||||||
magenta: EightBit(
|
|
||||||
0,
|
|
||||||
),
|
|
||||||
cyan: EightBit(
|
|
||||||
0,
|
|
||||||
),
|
|
||||||
white: EightBit(
|
|
||||||
0,
|
|
||||||
),
|
|
||||||
orange: EightBit(
|
|
||||||
0,
|
|
||||||
),
|
|
||||||
gray: EightBit(
|
|
||||||
0,
|
|
||||||
),
|
|
||||||
purple: EightBit(
|
|
||||||
0,
|
|
||||||
),
|
|
||||||
gold: EightBit(
|
|
||||||
0,
|
|
||||||
),
|
|
||||||
silver: EightBit(
|
|
||||||
0,
|
|
||||||
),
|
|
||||||
pink: EightBit(
|
|
||||||
0,
|
|
||||||
),
|
|
||||||
brown: EightBit(
|
|
||||||
0,
|
|
||||||
),
|
|
||||||
},
|
|
||||||
rounded_corners: false,
|
|
||||||
},
|
|
||||||
capabilities: PluginCapabilities {
|
|
||||||
arrow_fonts: false,
|
|
||||||
},
|
|
||||||
session_name: Some(
|
|
||||||
"zellij-test",
|
|
||||||
),
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
Update(
|
Update(
|
||||||
|
[],
|
||||||
|
),
|
||||||
|
Update(
|
||||||
|
[
|
||||||
|
(
|
||||||
None,
|
None,
|
||||||
Some(
|
Some(
|
||||||
1,
|
1,
|
||||||
|
|
@ -450,7 +329,11 @@ expression: "format!(\"{:#?}\", * received_plugin_instructions.lock().unwrap())"
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
Update(
|
Update(
|
||||||
|
[
|
||||||
|
(
|
||||||
None,
|
None,
|
||||||
Some(
|
Some(
|
||||||
1,
|
1,
|
||||||
|
|
@ -480,7 +363,11 @@ expression: "format!(\"{:#?}\", * received_plugin_instructions.lock().unwrap())"
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
Update(
|
Update(
|
||||||
|
[
|
||||||
|
(
|
||||||
None,
|
None,
|
||||||
Some(
|
Some(
|
||||||
1,
|
1,
|
||||||
|
|
@ -510,14 +397,22 @@ expression: "format!(\"{:#?}\", * received_plugin_instructions.lock().unwrap())"
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
Update(
|
Update(
|
||||||
|
[
|
||||||
|
(
|
||||||
None,
|
None,
|
||||||
Some(
|
Some(
|
||||||
10,
|
10,
|
||||||
),
|
),
|
||||||
InputReceived,
|
InputReceived,
|
||||||
),
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
Update(
|
Update(
|
||||||
|
[
|
||||||
|
(
|
||||||
None,
|
None,
|
||||||
Some(
|
Some(
|
||||||
1,
|
1,
|
||||||
|
|
@ -547,5 +442,7 @@ expression: "format!(\"{:#?}\", * received_plugin_instructions.lock().unwrap())"
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
Exit,
|
Exit,
|
||||||
]
|
]
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue