1
1
mirror of https://github.com/wez/wezterm.git synced 2024-12-24 13:52:55 +03:00

term: notify embedding application when palette changes

refs: #748
This commit is contained in:
Wez Furlong 2021-05-30 09:29:04 -07:00
parent bbadcb90e0
commit f5f393bf2c
4 changed files with 27 additions and 0 deletions

View File

@ -51,6 +51,8 @@ pub enum Alert {
/// When the title, or something that likely influences the title,
/// has been changed
TitleMaybeChanged,
/// When the color palette has been updated
PaletteChanged,
}
pub trait AlertHandler {

View File

@ -3268,6 +3268,9 @@ impl<'a> Performer<'a> {
self.screen.activate_primary_screen();
self.erase_in_display(EraseInDisplay::EraseScrollback);
self.erase_in_display(EraseInDisplay::EraseDisplay);
if let Some(handler) = self.alert_handler.as_mut() {
handler.alert(Alert::PaletteChanged);
}
}
_ => log::warn!("ESC: unhandled {:?}", esc),
@ -3435,6 +3438,9 @@ impl<'a> Performer<'a> {
}
}
}
if let Some(handler) = self.alert_handler.as_mut() {
handler.alert(Alert::PaletteChanged);
}
self.make_all_lines_dirty();
}
@ -3455,6 +3461,9 @@ impl<'a> Performer<'a> {
}
}
}
if let Some(handler) = self.alert_handler.as_mut() {
handler.alert(Alert::PaletteChanged);
}
}
OperatingSystemCommand::ChangeDynamicColors(first_color, colors) => {
@ -3508,6 +3517,9 @@ impl<'a> Performer<'a> {
}
idx += 1;
}
if let Some(handler) = self.alert_handler.as_mut() {
handler.alert(Alert::PaletteChanged);
}
self.make_all_lines_dirty();
}
@ -3544,6 +3556,9 @@ impl<'a> Performer<'a> {
| DynamicColorNumber::TektronixCursorColor => {}
}
}
if let Some(handler) = self.alert_handler.as_mut() {
handler.alert(Alert::PaletteChanged);
}
self.make_all_lines_dirty();
}
}

View File

@ -65,6 +65,10 @@ impl GuiFrontEnd {
log::info!("Ding! (this is the bell)");
}
MuxNotification::Alert {
pane_id: _,
alert: Alert::PaletteChanged,
}
| MuxNotification::Alert {
pane_id: _,
alert: Alert::TitleMaybeChanged,
} => {}

View File

@ -757,6 +757,12 @@ impl TermWindow {
} => {
self.update_title();
}
MuxNotification::Alert {
alert: Alert::PaletteChanged,
pane_id,
} => {
self.mux_pane_output_event(pane_id);
}
MuxNotification::PaneOutput(pane_id) => {
self.mux_pane_output_event(pane_id);
}