mirror of
https://github.com/wez/wezterm.git
synced 2024-11-27 02:25:28 +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:
parent
a189bb57c1
commit
3ae38eb5bf
@ -45,6 +45,7 @@ pub(crate) struct PerPane {
|
||||
mouse_grabbed: bool,
|
||||
sent_initial_palette: bool,
|
||||
seqno: SequenceNo,
|
||||
config_generation: usize,
|
||||
pub(crate) notifications: Vec<Alert>,
|
||||
}
|
||||
|
||||
@ -151,6 +152,18 @@ fn maybe_push_pane_changes(
|
||||
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 {
|
||||
per_pane.notifications.push(Alert::PaletteChanged);
|
||||
per_pane.sent_initial_palette = true;
|
||||
|
Loading…
Reference in New Issue
Block a user