Skip to content

A modern terminal with a built-in multiplexer: close it and your sessions keep running. Run shells and tons of AI agents across your machines, then pick them up from desktop, browser, TUI and more. Written in Rust with no UI framework: interface drawn straight on the GPU. No Electron, GPUI or webview.

Fix mux flicker storms and Space thread binding for remote windows

RoversX37c5bac888a5
diff --git a/mux/src/pane.rs b/mux/src/pane.rs
index 1c46d7ae..a0826492 100644
--- a/mux/src/pane.rs
+++ b/mux/src/pane.rs
@@ -262,6 +262,16 @@ pub trait Pane: Downcast + Send + Sync {
HashMap::new()
}
+ /// True for panes that mirror a pane owned by another mux (a mux
+ /// client's local proxy for a server-side pane). The terminal size of
+ /// such a pane is driven by the GUI layer, which reserves per-pane
+ /// chrome (the pane nav bar) out of the cell size; resizing it to the
+ /// raw cell size from split layout code would undo that reservation
+ /// and ping-pong sizes across the wire.
+ fn is_remote_mirror(&self) -> bool {
+ false
+ }
+
fn erase_scrollback(&self, _erase_mode: ScrollbackEraseMode) {}
/// Called to advise on whether this tab has focus
diff --git a/mux/src/tab.rs b/mux/src/tab.rs
index d83db473..58e14590 100644
--- a/mux/src/tab.rs
+++ b/mux/src/tab.rs
@@ -132,6 +132,13 @@ impl PaneStack {
fn resize(&self, size: TerminalSize) -> anyhow::Result<()> {
for pane in &self.panes {
+ // Remote mirror panes are sized by the GUI layer, which
+ // subtracts per-pane chrome (the pane nav bar) from the cell
+ // size; forcing them to the raw cell size here would undo that
+ // and bounce Resize PDUs back and forth with the server.
+ if pane.is_remote_mirror() {
+ continue;
+ }
pane.resize(size)?;
}
Ok(())
@@ -716,6 +723,39 @@ fn apply_sizes_from_splits(tree: &Tree, size: &TerminalSize) -> anyhow::Result<(
Ok(())
}
+/// Recompute split node sizes bottom-up from the contained panes'
+/// current dimensions, returning the aggregate size of the tree.
+fn compute_tree_size_from_panes(node: &mut Tree) -> Option<TerminalSize> {
+ match node {
+ Tree::Empty => None,
+ Tree::Leaf(stack) => {
+ let pane = stack.active_pane()?;
+ let dims = pane.get_dimensions();
+ let size = TerminalSize {
+ cols: dims.cols,
+ rows: dims.viewport_rows,
+ pixel_height: dims.pixel_height,
+ pixel_width: dims.pixel_width,
+ dpi: dims.dpi,
+ };
+ Some(size)
+ }
+ Tree::Node { left, right, data } => {
+ if let Some(data) = data {
+ if let Some(first) = compute_tree_size_from_panes(left) {
+ data.first = first;
+ }
+ if let Some(second) = compute_tree_size_from_panes(right) {
+ data.second = second;
+ }
+ Some(data.size())
+ } else {
+ None
+ }
+ }
+ }
+}
+
fn cell_dimensions(size: &TerminalSize) -> TerminalSize {
TerminalSize {
rows: 1,
@@ -1080,11 +1120,20 @@ impl TabInner {
self.pane.replace(cursor.tree());
self.zoomed = zoomed;
- // Let resize() decide whether anything actually changed (it updates
- // self.size itself, with min-size clamping). Do NOT pre-assign
- // self.size here: that would defeat resize()'s no-op guard and
- // re-emit TabResized on every resync, feeding the resize/resync
- // storm this sync is usually responding to.
+ // The rebuilt tree carries the peer's cell geometry (derived from
+ // its pane dimensions, which for client tabs are smaller than the
+ // local cells because the GUI reserves per-pane chrome). Recompute
+ // self.size from that tree so that the resize below starts from an
+ // accurate value, then re-impose the target size: for client tabs
+ // the target is the locally (window-)derived size, which stays
+ // authoritative over whatever round-tripped through the server.
+ // resize() is a no-op (and emits no TabResized) when the sizes
+ // already agree.
+ if let Some(root) = self.pane.as_mut() {
+ if let Some(tree_size) = compute_tree_size_from_panes(root) {
+ self.size = tree_size;
+ }
+ }
self.resize(size);
log::debug!(
@@ -1584,8 +1633,10 @@ impl TabInner {
if let Some(zoomed) = &self.zoomed {
self.size = size;
- if let Err(err) = zoomed.resize(size) {
- log::error!("failed to resize zoomed pane: {err:#}");
+ if !zoomed.is_remote_mirror() {
+ if let Err(err) = zoomed.resize(size) {
+ log::error!("failed to resize zoomed pane: {err:#}");
+ }
}
} else {
let dims = cell_dimensions(&size);
@@ -1678,39 +1729,8 @@ impl TabInner {
return;
}
- fn compute_size(node: &mut Tree) -> Option<TerminalSize> {
- match node {
- Tree::Empty => None,
- Tree::Leaf(stack) => {
- let pane = stack.active_pane()?;
- let dims = pane.get_dimensions();
- let size = TerminalSize {
- cols: dims.cols,
- rows: dims.viewport_rows,
- pixel_height: dims.pixel_height,
- pixel_width: dims.pixel_width,
- dpi: dims.dpi,
- };
- Some(size)
- }
- Tree::Node { left, right, data } => {
- if let Some(data) = data {
- if let Some(first) = compute_size(left) {
- data.first = first;
- }
- if let Some(second) = compute_size(right) {
- data.second = second;
- }
- Some(data.size())
- } else {
- None
- }
- }
- }
- }
-
if let Some(root) = self.pane.as_mut() {
- if let Some(size) = compute_size(root) {
+ if let Some(size) = compute_tree_size_from_panes(root) {
self.size = size;
}
}
diff --git a/wezterm-client/src/client.rs b/wezterm-client/src/client.rs
index fa295c35..e6355867 100644
--- a/wezterm-client/src/client.rs
+++ b/wezterm-client/src/client.rs
@@ -1304,6 +1304,7 @@ impl Client {
}
pub async fn send_pdu(&self, pdu: Pdu) -> anyhow::Result<Pdu> {
+ log::trace!("send_pdu {}", pdu.pdu_name());
let (promise, rx) = bounded(1);
self.sender
.send(ReaderMessage::SendPdu { pdu, promise })
diff --git a/wezterm-client/src/domain.rs b/wezterm-client/src/domain.rs
index 89d899d4..dc9c099b 100644
--- a/wezterm-client/src/domain.rs
+++ b/wezterm-client/src/domain.rs
@@ -580,13 +580,28 @@ impl ClientDomain {
if let Some((remote_window_id, remote_tab_id)) = tabroot.window_and_tab_ids() {
let tab;
+ // For a tab we already track, the locally-held size (driven
+ // by the GUI window geometry) is authoritative; the wire
+ // size reflects the server's pane dimensions, which are
+ // smaller than the local cells whenever the GUI reserves
+ // per-pane chrome (pane nav bar). Adopting the wire size
+ // here would shrink the tab by the chrome height on every
+ // resync. Only brand-new tabs take the wire size, until a
+ // GUI window adopts and resizes them.
+ let mut sync_size = root_size;
remote_windows_to_forget.remove(&remote_window_id);
remote_tabs_to_forget.remove(&remote_tab_id);
if let Some(tab_id) = inner.remote_to_local_tab_id(remote_tab_id) {
match mux.get_tab(tab_id) {
- Some(t) => tab = t,
+ Some(t) => {
+ let local_size = t.get_size();
+ if local_size.rows > 0 && local_size.cols > 0 {
+ sync_size = local_size;
+ }
+ tab = t;
+ }
None => {
// We likely decided that we hit EOF on the tab and
// removed it from the mux. Let's add it back, but
@@ -612,7 +627,7 @@ impl ClientDomain {
log::debug!("domain: {} tree: {:#?}", inner.local_domain_id, tabroot);
let mut workspace = None;
- tab.sync_with_pane_tree(root_size, tabroot, |entry| {
+ tab.sync_with_pane_tree(sync_size, tabroot, |entry| {
workspace.replace(entry.workspace.clone());
remote_panes_to_forget.remove(&entry.pane_id);
if let Some(pane_id) = inner.remote_to_local_pane_id(entry.pane_id) {
@@ -654,29 +669,46 @@ impl ClientDomain {
});
if let Some(local_window_id) = inner.remote_to_local_window(remote_window_id) {
- let mut window = mux
- .get_window_mut(local_window_id)
- .expect("no such window!?");
log::debug!(
"domain: {} adding tab to existing local window {}",
inner.local_domain_id,
local_window_id
);
- if window.idx_by_id(tab.tab_id()).is_none() {
- window.push(&tab);
+ let needs_add = mux
+ .get_window(local_window_id)
+ .expect("no such window!?")
+ .idx_by_id(tab.tab_id())
+ .is_none();
+ if needs_add {
+ // Use add_tab_to_window rather than window.push so
+ // that MuxNotification::TabAddedToWindow reaches the
+ // GUI: it relies on that event to impose the local
+ // window geometry on tabs that arrive via resync
+ // (their wire size is the server's, which sits below
+ // the local size by the pane nav bar reservation).
+ mux.add_tab_to_window(&tab, local_window_id)?;
}
continue;
}
if let Some(local_window_id) = primary_window_id {
- // Verify that the workspace is consistent between the local and remote
- // windows
- if Some(
- mux.get_window(local_window_id)
- .expect("primary window to be valid")
- .get_workspace(),
- ) == workspace.as_deref()
- {
+ // Adopt the remote window into the local primary window
+ // when the workspaces agree, or unconditionally when the
+ // local window is claimed for this domain (a ThinkTerm
+ // Space connect window): the claim carries the identity,
+ // and the local workspace name (the Space thread) wins.
+ let (workspace_matches, domain_owned, local_workspace) = {
+ let window = mux
+ .get_window(local_window_id)
+ .expect("primary window to be valid");
+ let local_workspace = window.get_workspace().to_string();
+ (
+ Some(local_workspace.as_str()) == workspace.as_deref(),
+ window.origin_domain() == Some(inner.local_domain_id),
+ local_workspace,
+ )
+ };
+ if workspace_matches || domain_owned {
// Yes! We can use this window
log::debug!(
"adding remote window {} as tab to local window {}",
@@ -689,6 +721,27 @@ impl ClientDomain {
);
mux.add_tab_to_window(&tab, local_window_id)?;
primary_window_id.take();
+ if !workspace_matches {
+ // Bring the server's workspace in line with the
+ // local window's so that future attaches fold
+ // this window by name as well.
+ let inner = Arc::clone(&inner);
+ promise::spawn::spawn(async move {
+ let request = codec::SetWindowWorkspace {
+ window_id: remote_window_id,
+ workspace: local_workspace,
+ };
+ if let Err(err) =
+ inner.client.set_window_workspace(request).await
+ {
+ log::error!(
+ "failed to align remote window {remote_window_id} \
+ workspace: {err:#}"
+ );
+ }
+ })
+ .detach();
+ }
continue;
}
}
diff --git a/wezterm-client/src/pane/clientpane.rs b/wezterm-client/src/pane/clientpane.rs
index 7e18f823..bd0e7be3 100644
--- a/wezterm-client/src/pane/clientpane.rs
+++ b/wezterm-client/src/pane/clientpane.rs
@@ -169,15 +169,21 @@ impl ClientPane {
}
},
Pdu::SetPalette(SetPalette { palette, .. }) => {
- *self.application_palette.lock() = palette != *self.configured_palette.lock();
-
- *self.palette.lock() = palette;
- let mux = Mux::get();
- self.renderable.lock().inner.borrow_mut().make_all_stale();
- mux.notify(MuxNotification::Alert {
- pane_id: self.local_pane_id,
- alert: Alert::PaletteChanged,
- });
+ // A redundant advisory must not invalidate the whole
+ // render surface (make_all_stale forces a refetch of every
+ // visible line, which flashes the pane contents).
+ if palette != *self.palette.lock() {
+ *self.application_palette.lock() =
+ palette != *self.configured_palette.lock();
+
+ *self.palette.lock() = palette;
+ let mux = Mux::get();
+ self.renderable.lock().inner.borrow_mut().make_all_stale();
+ mux.notify(MuxNotification::Alert {
+ pane_id: self.local_pane_id,
+ alert: Alert::PaletteChanged,
+ });
+ }
}
Pdu::NotifyAlert(NotifyAlert { alert, .. }) => {
let mux = Mux::get();
@@ -582,6 +588,10 @@ impl Pane for ClientPane {
}
}
+ fn is_remote_mirror(&self) -> bool {
+ true
+ }
+
fn erase_scrollback(&self, erase_mode: ScrollbackEraseMode) {
let client = Arc::clone(&self.client);
let remote_pane_id = self.remote_pane_id;
@@ -633,6 +643,14 @@ impl Pane for ClientPane {
fn set_config(&self, config: Arc<dyn TerminalConfiguration>) {
let palette = config.color_palette();
+ // Only propagate a palette that actually changed. set_config is
+ // invoked for every pane on every config generation bump (which
+ // can be frequent: any write near a watched config path reloads),
+ // and an unconditional send makes the server re-advise the palette
+ // to every attached client, which invalidates their entire render
+ // surface -- a visible full-window flicker.
+ let changed = *self.configured_palette.lock() != palette;
+
// If the application running in the pane hasn't changed the
// palette through escape sequences, speculatively adopt the
// new palette so that it updates with the lowest latency.
@@ -641,19 +659,21 @@ impl Pane for ClientPane {
}
*self.configured_palette.lock() = palette.clone();
- // and now send the color palette to the server
- let client = Arc::clone(&self.client);
- let remote_pane_id = self.remote_pane_id;
- promise::spawn::spawn(async move {
- client
- .client
- .set_configured_palette_for_pane(SetPalette {
- pane_id: remote_pane_id,
- palette,
- })
- .await
- })
- .detach();
+ if changed {
+ // and now send the color palette to the server
+ let client = Arc::clone(&self.client);
+ let remote_pane_id = self.remote_pane_id;
+ promise::spawn::spawn(async move {
+ client
+ .client
+ .set_configured_palette_for_pane(SetPalette {
+ pane_id: remote_pane_id,
+ palette,
+ })
+ .await
+ })
+ .detach();
+ }
self.config.lock().replace(config);
}
diff --git a/wezterm-gui/src/main.rs b/wezterm-gui/src/main.rs
index d9ec0525..180f7dae 100644
--- a/wezterm-gui/src/main.rs
+++ b/wezterm-gui/src/main.rs
@@ -424,12 +424,19 @@ async fn connect_domain_into_space(
);
}
- // Create the connect mux window in the default workspace (the remote's
- // primary window folds into it only when workspace names match), and
- // claim it before the builder drops so the WindowCreated notification
- // can never race a reconcile-spawned duplicate.
+ // Create the connect mux window directly in the Space's main-thread
+ // workspace so that thread switching can find it again by name (the
+ // fold of the remote's primary window into this window goes by the
+ // origin-domain claim, not by workspace name). Claim it before the
+ // builder drops so the WindowCreated notification can never race a
+ // reconcile-spawned duplicate.
+ let thread_workspace = workspace_threads::ensure_mux_thread_workspace(&plan);
let window_id = {
- let builder = mux.new_empty_window_for_domain(None, None, Some(domain.domain_id()));
+ let builder = mux.new_empty_window_for_domain(
+ Some(thread_workspace),
+ None,
+ Some(domain.domain_id()),
+ );
let id = *builder;
crate::frontend::front_end().claim_spawned_mux_window(id);
id
@@ -469,11 +476,11 @@ async fn connect_domain_into_space(
}
trigger_and_log_gui_attached(MuxDomain(domain.domain_id())).await;
- // Deliberately NO workspace rename here. The Space binding is carried by
- // the claimed space on the TermWindow; renaming the mux window's
- // workspace would be reconciled to the REMOTE mux server by the client
- // domain (SetWindowWorkspace), polluting the server's workspace names and
- // breaking the primary-window fold on every future attach.
+ // No explicit workspace rename AFTER attach: the window was created in
+ // the thread workspace up front, and the client domain aligns the
+ // server's workspace to it when the primary window folds in (see
+ // process_pane_list). Renaming post-attach used to race the fold and
+ // polluted the server's workspace names.
Ok(())
}
diff --git a/wezterm-gui/src/termwindow/mod.rs b/wezterm-gui/src/termwindow/mod.rs
index bd35c4cc..a880797c 100644
--- a/wezterm-gui/src/termwindow/mod.rs
+++ b/wezterm-gui/src/termwindow/mod.rs
@@ -2197,8 +2197,14 @@ impl TermWindow {
|| size.pixel_height != self.terminal_size.pixel_height
{
self.set_window_size(size, window)?;
- } else if tab_size.dpi == 0 {
- log::debug!("fixup dpi in newly added tab");
+ } else if tab_size != self.terminal_size {
+ // A tab that arrived via a mux resync carries the
+ // server's size (its pane dims, which sit below the
+ // window size by the pane nav bar reservation).
+ // The window geometry is authoritative locally:
+ // impose it so that the first activation doesn't
+ // subtract the nav bar from an already-reduced
+ // size. Tab::resize no-ops when sizes agree.
tab.resize(self.terminal_size);
}
}
diff --git a/wezterm-gui/src/termwindow/mouseevent.rs b/wezterm-gui/src/termwindow/mouseevent.rs
index a8620e85..47be91c2 100644
--- a/wezterm-gui/src/termwindow/mouseevent.rs
+++ b/wezterm-gui/src/termwindow/mouseevent.rs
@@ -785,8 +785,7 @@ impl super::TermWindow {
+ (pos.left as isize * global_cell_size.width);
let pane_top =
padding_top as isize + first_line_offset + (pos.top as isize * global_cell_size.height);
- let pane_nav_height =
- self.pane_nav_bar_height_for_pane(&pos.pane, self.render_metrics) as isize;
+ let pane_nav_height = pane_nav_bar_height_for_metrics(self.render_metrics) as isize;
let local_x = event.coords.x.sub(pane_left);
let local_y = event.coords.y.sub(pane_top + pane_nav_height);
diff --git a/wezterm-gui/src/termwindow/render/pane.rs b/wezterm-gui/src/termwindow/render/pane.rs
index 45147ff8..8b086f68 100644
--- a/wezterm-gui/src/termwindow/render/pane.rs
+++ b/wezterm-gui/src/termwindow/render/pane.rs
@@ -38,9 +38,8 @@ use window::color::LinearRgba;
use window::MouseEventKind as WMEK;
impl crate::TermWindow {
- /// Draw height of the nav bar for this pane. Always the metric height:
- /// for remote mux panes it overlays the content (no rows are stolen from
- /// the viewport; see pane_nav_bar_height_for_pane in resize.rs).
+ /// Height of the nav bar for this pane: the metric height, clamped so
+ /// that at least one terminal row of the pane's cell remains visible.
fn pane_nav_bar_height(&self, pos: &PositionedPane) -> usize {
pane_nav_bar_height_for_metrics(self.render_metrics).min(
pos.pixel_height
@@ -820,12 +819,7 @@ impl crate::TermWindow {
}
}
- // Return the CONTENT OFFSET, not the drawn height: remote mux panes
- // steal no viewport rows (the bar overlays the content), so their
- // cells start at the pane's top edge.
- Ok(self
- .pane_nav_bar_height_for_pane(&pos.pane, self.render_metrics)
- .min(nav_height))
+ Ok(nav_height)
}
fn paint_pane_nav_icon_button(
diff --git a/wezterm-gui/src/termwindow/resize.rs b/wezterm-gui/src/termwindow/resize.rs
index c29b400d..8288061e 100644
--- a/wezterm-gui/src/termwindow/resize.rs
+++ b/wezterm-gui/src/termwindow/resize.rs
@@ -263,33 +263,6 @@ impl super::TermWindow {
}
}
- /// Rows (in pixels) the per-pane navigation bar STEALS from the pane's
- /// terminal viewport. Panes that belong to a mux client domain (remote
- /// wezterm mux) steal nothing: the mux protocol sizes a leaf tab from
- /// its pane, so shrinking a ClientPane's viewport echoes back from the
- /// server as a smaller tab and produces a feedback loop that shrinks
- /// the window a few rows per round-trip. For those panes the nav bar is
- /// drawn as an overlay on top of the content instead (see render/pane.rs
- /// which uses the plain metric height for drawing).
- pub(crate) fn pane_nav_bar_height_for_pane(
- &self,
- pane: &std::sync::Arc<dyn mux::pane::Pane>,
- render_metrics: RenderMetrics,
- ) -> usize {
- let is_client_pane = Mux::get()
- .get_domain(pane.domain_id())
- .map_or(false, |domain| {
- domain
- .downcast_ref::<wezterm_client::domain::ClientDomain>()
- .is_some()
- });
- if is_client_pane {
- 0
- } else {
- pane_nav_bar_height_for_metrics(render_metrics)
- }
- }
-
pub(crate) fn terminal_size_for_positioned_pane(
&self,
pos: &PositionedPane,
@@ -297,8 +270,7 @@ impl super::TermWindow {
) -> TerminalSize {
let cell_width = render_metrics.cell_size.width.max(1) as usize;
let cell_height = render_metrics.cell_size.height.max(1) as usize;
- let pane_nav_height = self
- .pane_nav_bar_height_for_pane(&pos.pane, render_metrics)
+ let pane_nav_height = pane_nav_bar_height_for_metrics(render_metrics)
.min(pos.pixel_height.saturating_sub(cell_height));
let pixel_width = pos.pixel_width.max(cell_width);
let pixel_height = pos
diff --git a/wezterm-gui/src/workspace_threads.rs b/wezterm-gui/src/workspace_threads.rs
index bdc20b6b..55afa51f 100644
--- a/wezterm-gui/src/workspace_threads.rs
+++ b/wezterm-gui/src/workspace_threads.rs
@@ -3432,6 +3432,37 @@ pub fn ensure_mux_domain_space(domain_name: &str) -> MuxDomainSpacePlan {
}
}
+/// Resolve (and record) the workspace that a mux-domain Space's thread
+/// lives in. The connect window is created directly in this workspace so
+/// that thread switching can find it again by name instead of
+/// materializing a duplicate; recording it as materialized keeps
+/// reconnects and switch-backs symmetric.
+pub fn ensure_mux_thread_workspace(plan: &MuxDomainSpacePlan) -> String {
+ let mut store = THREAD_STORE.lock();
+ let mut name = None;
+ if let Some(project) = store
+ .projects
+ .iter_mut()
+ .find(|project| project.id == plan.project_id)
+ {
+ if let Some(thread) = project
+ .threads
+ .iter_mut()
+ .find(|thread| thread.id == plan.thread_id)
+ {
+ let workspace = thread
+ .materialized_workspace_name
+ .clone()
+ .or_else(|| thread.planned_workspace_name.clone())
+ .unwrap_or_else(|| workspace_name_for_thread(&plan.project_id, &plan.thread_id));
+ thread.materialized_workspace_name = Some(workspace.clone());
+ name = Some(workspace);
+ }
+ }
+ persist_locked(&store);
+ name.unwrap_or_else(|| workspace_name_for_thread(&plan.project_id, &plan.thread_id))
+}
+
pub fn remote_host_id_for_project_id(project_id: &str) -> &str {
project_id
.split_once(REMOTE_PROJECT_SPACE_SEPARATOR)
diff --git a/wezterm-mux-server-impl/src/sessionhandler.rs b/wezterm-mux-server-impl/src/sessionhandler.rs
index 056eaf75..47615245 100644
--- a/wezterm-mux-server-impl/src/sessionhandler.rs
+++ b/wezterm-mux-server-impl/src/sessionhandler.rs
@@ -14,6 +14,7 @@ use std::sync::{Arc, Mutex};
use std::time::Instant;
use termwiz::surface::SequenceNo;
use url::Url;
+use wezterm_term::color::ColorPalette;
use wezterm_term::terminal::Alert;
use wezterm_term::StableRowIndex;
@@ -43,6 +44,7 @@ pub(crate) struct PerPane {
dimensions: RenderableDimensions,
mouse_grabbed: bool,
sent_initial_palette: bool,
+ last_sent_palette: Option<ColorPalette>,
seqno: SequenceNo,
config_generation: usize,
pub(crate) notifications: Vec<Alert>,
@@ -171,13 +173,23 @@ fn maybe_push_pane_changes(
per_pane.notifications.push(Alert::PaletteChanged);
per_pane.sent_initial_palette = true;
}
- for alert in per_pane.notifications.drain(..) {
+ let notifications: Vec<Alert> = per_pane.notifications.drain(..).collect();
+ for alert in notifications {
match alert {
Alert::PaletteChanged => {
+ let palette = pane.palette();
+ // Config generation bumps synthesize PaletteChanged even
+ // when the effective palette is unchanged; pushing those
+ // makes every attached client invalidate its entire render
+ // surface for this pane. Only push real changes.
+ if per_pane.last_sent_palette.as_ref() == Some(&palette) {
+ continue;
+ }
+ per_pane.last_sent_palette = Some(palette.clone());
sender.send(DecodedPdu {
pdu: Pdu::SetPalette(SetPalette {
pane_id: pane.pane_id(),
- palette: pane.palette(),
+ palette,
}),
serial: 0,
})?;
@@ -248,6 +260,7 @@ impl SessionHandler {
let start = Instant::now();
let sender = self.to_write_tx.clone();
let serial = decoded.serial;
+ log::trace!("recv {} {}", serial, decoded.pdu.pdu_name());
if let Some(client_id) = &self.client_id {
if decoded.pdu.is_user_input() {