1
1
mirror of https://github.com/wez/wezterm.git synced 2024-12-23 13:21:38 +03:00

mux: move-pane-to-new-tab didn't resync structure

Resolution is to propagate the MuxNotification to the clients
and have them resync.

refs: https://github.com/wez/wezterm/issues/3219
This commit is contained in:
Wez Furlong 2023-03-25 20:48:55 -07:00
parent 59503034c7
commit 98e137942a
No known key found for this signature in database
GPG Key ID: 7A7F66A31EC9B387
5 changed files with 19 additions and 4 deletions

View File

@ -417,7 +417,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 = 35;
pub const CODEC_VERSION: usize = 36;
// Defines the Pdu enum.
// Each struct has an explicit identifying number.
@ -470,6 +470,7 @@ pdu! {
GetPaneRenderableDimensionsResponse: 52,
PaneFocused: 53,
TabResized: 54,
TabAddedToWindow: 55,
}
impl Pdu {
@ -736,6 +737,12 @@ pub struct NotifyAlert {
pub alert: Alert,
}
#[derive(Deserialize, Serialize, PartialEq, Debug)]
pub struct TabAddedToWindow {
pub tab_id: TabId,
pub window_id: WindowId,
}
#[derive(Deserialize, Serialize, PartialEq, Debug)]
pub struct TabResized {
pub tab_id: TabId,

View File

@ -78,6 +78,8 @@ As features stabilize some brief notes about them will accumulate here.
tab was explicitly resized. #3366
* mux: initial attach and spawn would leave the dpi at the assumed dpi resulting
in incorrect image scaling for imgcat. #3366
* mux: `wezterm cli move-pane-to-new-tab` didn't resync new window structure
and would appear to have had no effect until you detached and re-attached. #3219
#### Updated
* Bundled JetBrainsMono to 2.304. #3362

View File

@ -220,8 +220,8 @@ fn process_unilateral(
return Ok(());
}
Pdu::TabResized(TabResized { tab_id }) => {
log::trace!("TabResized {tab_id}");
Pdu::TabResized(_) | Pdu::TabAddedToWindow(_) => {
log::trace!("resync due to {:?}", decoded.pdu);
promise::spawn::spawn_into_main_thread(async move {
let mux = Mux::try_get().ok_or_else(|| anyhow!("no more mux"))?;
let client_domain = mux

View File

@ -139,7 +139,12 @@ where
.await?;
stream.flush().await.context("flushing PDU to client")?;
}
Ok(Item::Notif(MuxNotification::TabAddedToWindow { .. })) => {}
Ok(Item::Notif(MuxNotification::TabAddedToWindow { tab_id, window_id })) => {
Pdu::TabAddedToWindow(codec::TabAddedToWindow { tab_id, window_id })
.encode_async(&mut stream, 0)
.await?;
stream.flush().await.context("flushing PDU to client")?;
}
Ok(Item::Notif(MuxNotification::WindowRemoved(_window_id))) => {}
Ok(Item::Notif(MuxNotification::WindowCreated(_window_id))) => {}
Ok(Item::Notif(MuxNotification::WindowInvalidated(_window_id))) => {}

View File

@ -751,6 +751,7 @@ impl SessionHandler {
| Pdu::TabResized { .. }
| Pdu::GetImageCellResponse { .. }
| Pdu::MovePaneToNewTabResponse { .. }
| Pdu::TabAddedToWindow { .. }
| Pdu::GetPaneRenderableDimensionsResponse { .. }
| Pdu::ErrorResponse { .. } => {
send_response(Err(anyhow!("expected a request, got {:?}", decoded.pdu)))