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(gui): keep overview card pictures through a glyph atlas rebuild

RoversXc8e2bbe12af8
diff --git a/wezterm-gui/src/termwindow/mod.rs b/wezterm-gui/src/termwindow/mod.rs
index 00460b29..e9b006f7 100644
--- a/wezterm-gui/src/termwindow/mod.rs
+++ b/wezterm-gui/src/termwindow/mod.rs
@@ -4102,8 +4102,11 @@ impl TermWindow {
// them would draw the overview in whatever now occupies those texels.
// `PreviewQuadKey` also carries `shape_generation`, so this is belt and
// braces -- but the two live in different files and the invariant
- // belongs with the rest of the captures.
- self.preview_quad_cache.borrow_mut().clear();
+ // belongs with the rest of the captures. A card's texture, though, is
+ // finished pixels a repack does not touch, and stays on screen until
+ // the card is rebuilt: dropped with the quads, every card went blank at
+ // once -- the one a terminal was landing in among them.
+ self.retire_preview_quads_for_new_atlas();
// The half-built card holds the same kind of atlas-addressed quads.
*self.preview_rebuild_partial.borrow_mut() = None;
let Some(fade) = self.content_view_fade.as_mut() else {
diff --git a/wezterm-gui/src/termwindow/render/paint.rs b/wezterm-gui/src/termwindow/render/paint.rs
index c79f5a64..010d73db 100644
--- a/wezterm-gui/src/termwindow/render/paint.rs
+++ b/wezterm-gui/src/termwindow/render/paint.rs
@@ -3074,6 +3074,22 @@ impl crate::TermWindow {
Ok(())
}
+ /// After the glyph atlas has been rebuilt: drop every card's recorded
+ /// quads, which address glyphs where the old atlas kept them, but keep its
+ /// texture -- finished pixels a repack does not touch -- on screen until
+ /// the card has been rebuilt. A card without one has nothing left to show.
+ pub(crate) fn retire_preview_quads_for_new_atlas(&self) {
+ self.preview_quad_cache.borrow_mut().retain(|_, cached| {
+ if cached.texture.is_none() {
+ return false;
+ }
+ cached.heap.recycle();
+ // Matches no snapshot, so the card rebuilds when its turn comes.
+ cached.key.snapshot = 0;
+ true
+ });
+ }
+
/// Build one card's thumbnail into `layers`, whole.
///
/// Everything here is laid out against `preview.area` -- the card's full