From 6e7d415bcfc09bc5ad293cf1db919e9d17c28034 Mon Sep 17 00:00:00 2001 From: Can Celik Date: Fri, 11 Sep 2026 02:08:31 +0300 Subject: fix: keep terminal snapshots consistent while scrolling (#3928) refs #3900 --- src/pane/terminal.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/pane') diff --git a/src/pane/terminal.rs b/src/pane/terminal.rs index 071bb20a..b201702b 100644 --- a/src/pane/terminal.rs +++ b/src/pane/terminal.rs @@ -192,6 +192,8 @@ pub(crate) struct GhosttyPaneTerminal { } pub(crate) struct GhosttyPaneCore { + #[cfg(test)] + pub dirty_collection_hook: Option>, pub terminal: crate::ghostty::Terminal, #[cfg(windows)] recent_fallback: windows_recent_fallback::Cache, @@ -1145,6 +1147,8 @@ impl GhosttyPaneTerminal { key_encoder.set_from_terminal(&terminal); Ok(Self { core: Mutex::new(GhosttyPaneCore { + #[cfg(test)] + dirty_collection_hook: None, terminal, #[cfg(windows)] recent_fallback: windows_recent_fallback::Cache::default(), @@ -2363,7 +2367,13 @@ impl GhosttyPaneTerminal { self.core .lock() .ok() - .map(|mut core| ghostty_collect_dirty_patch(&mut core, area_width, area_height)) + .map(|mut core| { + #[cfg(test)] + if let Some(hook) = core.dirty_collection_hook.take() { + hook(); + } + ghostty_collect_dirty_patch(&mut core, area_width, area_height) + }) .unwrap_or(TerminalDirtyPatchOutcome::Fallback) } } -- cgit v1.2.3