diff options
| author | Can Celik <ogulcancelik@gmail.com> | 2026-09-11 02:08:31 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-09-11 02:08:31 +0300 |
| commit | 6e7d415bcfc09bc5ad293cf1db919e9d17c28034 (patch) | |
| tree | e034d340d55006a91635a8ca29df75a14a2445c8 /src/pane | |
| parent | 58271459401fa461707c042f7f03867ddcfff3ea (diff) | |
fix: keep terminal snapshots consistent while scrolling (#3928)
refs #3900
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) } } |
