fix invalidation on palette change

refs: https://github.com/wez/wezterm/issues/4932
and possibly: https://github.com/wez/wezterm/issues/2635
This commit is contained in:
Wez Furlong committed 2024-02-01 15:58:14 -07:00
1 parent b8d93edce6
commit aa94a98314
4 files changed
+25 -19

No files matched your search

+2
View File
@@ -30,6 +30,8 @@ As features stabilize some brief notes about them will accumulate here.
* It was not possible to specify `freetype_load_flags = 'DEFAULT'`. #4902
* macOS: fallback fonts could select thin or otherwise unspecified font
attributes. #4808
* Changing the palette via escape sequences didn't invalidate caches
correctly, so those escapes sequences wouldn't take effect. #4932 #2635
### 20240128-202157-1e552d76
+7
View File
@@ -919,6 +919,13 @@ impl TerminalState {
}
}
fn palette_did_change(&mut self) {
self.make_all_lines_dirty();
if let Some(handler) = self.alert_handler.as_mut() {
handler.alert(Alert::PaletteChanged);
}
}
/// When dealing with selection, mark a range of lines as dirty
pub fn make_all_lines_dirty(&mut self) {
let seqno = self.seqno;
+5 -18
View File
@@ -705,9 +705,7 @@ impl<'a> Performer<'a> {
self.screen.activate_primary_screen(seqno);
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);
}
self.palette_did_change();
}
_ => {
@@ -944,10 +942,7 @@ impl<'a> Performer<'a> {
}
}
self.implicit_palette_reset_if_same_as_configured();
if let Some(handler) = self.alert_handler.as_mut() {
handler.alert(Alert::PaletteChanged);
}
self.make_all_lines_dirty();
self.palette_did_change();
}
OperatingSystemCommand::ResetColors(colors) => {
@@ -968,9 +963,7 @@ impl<'a> Performer<'a> {
}
}
self.implicit_palette_reset_if_same_as_configured();
if let Some(handler) = self.alert_handler.as_mut() {
handler.alert(Alert::PaletteChanged);
}
self.palette_did_change();
}
OperatingSystemCommand::ChangeDynamicColors(first_color, colors) => {
@@ -1025,10 +1018,7 @@ impl<'a> Performer<'a> {
idx += 1;
}
self.implicit_palette_reset_if_same_as_configured();
if let Some(handler) = self.alert_handler.as_mut() {
handler.alert(Alert::PaletteChanged);
}
self.make_all_lines_dirty();
self.palette_did_change();
}
OperatingSystemCommand::ResetDynamicColor(color) => {
@@ -1065,10 +1055,7 @@ impl<'a> Performer<'a> {
}
}
self.implicit_palette_reset_if_same_as_configured();
if let Some(handler) = self.alert_handler.as_mut() {
handler.alert(Alert::PaletteChanged);
}
self.make_all_lines_dirty();
self.palette_did_change();
}
}
}
+11 -1
View File
@@ -1157,6 +1157,10 @@ impl TermWindow {
alert: Alert::PaletteChanged,
pane_id,
} => {
// Shape cache includes color information, so
// ensure that we invalidate that as part of
// this overall invalidation for the palette
self.dispatch_notif(TermWindowNotif::InvalidateShapeCache, window)?;
self.mux_pane_output_event(pane_id);
}
MuxNotification::Alert {
@@ -1418,7 +1422,7 @@ impl TermWindow {
}
}
MuxNotification::Alert {
alert: Alert::ToastNotification { .. } | Alert::PaletteChanged { .. },
alert: Alert::ToastNotification { .. },
..
}
| MuxNotification::AssignClipboard { .. }
@@ -1433,6 +1437,12 @@ impl TermWindow {
| MuxNotification::WorkspaceRenamed { .. }
| MuxNotification::Empty
| MuxNotification::WindowWorkspaceChanged(_) => return true,
MuxNotification::Alert {
alert: Alert::PaletteChanged { .. },
..
} => {
// fall through
}
}
window.notify(TermWindowNotif::MuxNotification(n));