mux protocol sending alerts to client

refs: https://github.com/wez/wezterm/issues/748
refs: https://github.com/wez/wezterm/issues/489
This commit is contained in:
Wez Furlong committed 2021-05-30 10:18:30 -07:00
1 parent f5f393bf2c
commit dc4c8f07dd
6 files changed
+116 -21

No files matched your search

+22 -7
View File
@@ -30,7 +30,8 @@ use std::sync::Arc;
use termwiz::hyperlink::Hyperlink;
use termwiz::surface::Line;
use varbincode;
use wezterm_term::{ClipboardSelection, StableRowIndex};
use wezterm_term::color::ColorPalette;
use wezterm_term::{Alert, ClipboardSelection, StableRowIndex};
/// Returns the encoded length of the leb128 representation of value
fn encoded_length(value: u64) -> usize {
@@ -400,7 +401,7 @@ macro_rules! pdu {
/// The overall version of the codec.
/// This must be bumped when backwards incompatible changes
/// are made to the types and protocol.
pub const CODEC_VERSION: usize = 7;
pub const CODEC_VERSION: usize = 8;
// Defines the Pdu enum.
// Each struct has an explicit identifying number.
@@ -437,6 +438,8 @@ pdu! {
KillPane: 35,
SpawnV2: 36,
PaneRemoved: 37,
SetPalette: 38,
NotifyAlert: 39,
}
impl Pdu {
@@ -508,11 +511,11 @@ impl Pdu {
pub fn pane_id(&self) -> Option<PaneId> {
match self {
Pdu::GetPaneRenderChangesResponse(GetPaneRenderChangesResponse { pane_id, .. }) => {
Some(*pane_id)
}
Pdu::SetClipboard(SetClipboard { pane_id, .. }) => Some(*pane_id),
Pdu::PaneRemoved(PaneRemoved { pane_id }) => Some(*pane_id),
Pdu::GetPaneRenderChangesResponse(GetPaneRenderChangesResponse { pane_id, .. })
| Pdu::SetPalette(SetPalette { pane_id, .. })
| Pdu::NotifyAlert(NotifyAlert { pane_id, .. })
| Pdu::SetClipboard(SetClipboard { pane_id, .. })
| Pdu::PaneRemoved(PaneRemoved { pane_id }) => Some(*pane_id),
_ => None,
}
}
@@ -675,6 +678,18 @@ pub struct SetClipboard {
pub selection: ClipboardSelection,
}
#[derive(Deserialize, Serialize, PartialEq, Debug)]
pub struct SetPalette {
pub pane_id: PaneId,
pub palette: ColorPalette,
}
#[derive(Deserialize, Serialize, PartialEq, Debug)]
pub struct NotifyAlert {
pub pane_id: PaneId,
pub alert: Alert,
}
#[derive(Deserialize, Serialize, PartialEq, Debug)]
pub struct Resize {
pub containing_tab_id: TabId,