diff options
Diffstat (limited to 'src/pane')
| -rw-r--r-- | src/pane/terminal.rs | 12 |
1 files changed, 11 insertions, 1 deletions
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<Box<dyn FnOnce() + Send>>, 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) } } |
