1
1
mirror of https://github.com/wez/wezterm.git synced 2024-11-30 06:03:39 +03:00

mux: synthesize PaletteChanged event when config is reloaded

This is slightly misusing or misattributing things, but in
the context of the problem at hand, it is OK.

The issue is that palette changes are normally signalled by
the terminal instance in response to escape sequences.  Those
changes are propagated to the mux client through the existing
alerting channel.

If the palette is changed implicitly via a config change, then
the terminal doesn't trigger that alert and the mux client(s)
don't know that they need to refresh the palette.

This commit tracks the last config generation per pane and
synthesizes a palette alert when it changes.

It might be better to have another variant of alert to indicate
config changes.

refs: #1526
This commit is contained in:
Wez Furlong 2022-01-10 18:13:42 -07:00
parent a189bb57c1
commit 3ae38eb5bf

View File

@ -45,6 +45,7 @@ pub(crate) struct PerPane {
mouse_grabbed: bool, mouse_grabbed: bool,
sent_initial_palette: bool, sent_initial_palette: bool,
seqno: SequenceNo, seqno: SequenceNo,
config_generation: usize,
pub(crate) notifications: Vec<Alert>, pub(crate) notifications: Vec<Alert>,
} }
@ -151,6 +152,18 @@ fn maybe_push_pane_changes(
serial: 0, serial: 0,
})?; })?;
} }
let config = config::configuration();
if per_pane.config_generation != config.generation() {
per_pane.config_generation = config.generation();
// If the config changed, it may have changed colors
// in the palette that we need to push down, so we
// synthesize a palette change notification to let
// the client know
per_pane.notifications.push(Alert::PaletteChanged);
per_pane.sent_initial_palette = true;
}
if !per_pane.sent_initial_palette { if !per_pane.sent_initial_palette {
per_pane.notifications.push(Alert::PaletteChanged); per_pane.notifications.push(Alert::PaletteChanged);
per_pane.sent_initial_palette = true; per_pane.sent_initial_palette = true;