From cc7c696cd0772e466da403eb4e3f00f4e8d8ae1e Mon Sep 17 00:00:00 2001 From: Can Celik Date: Sat, 19 Sep 2026 14:47:18 +0300 Subject: feat: add configurable pane screen and scrollback clearing (#4383) --- src/pane/terminal.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/pane') diff --git a/src/pane/terminal.rs b/src/pane/terminal.rs index 4a6bc173..4d7f07b1 100644 --- a/src/pane/terminal.rs +++ b/src/pane/terminal.rs @@ -258,6 +258,10 @@ impl PaneTerminal { self.ghostty.scroll_reset(); } + pub fn clear_screen(&self) -> Result<(), String> { + self.ghostty.clear_screen() + } + pub fn set_scroll_offset_from_bottom(&self, lines: usize) { self.ghostty.set_scroll_offset_from_bottom(lines); } @@ -1773,6 +1777,21 @@ impl GhosttyPaneTerminal { } } + pub fn clear_screen(&self) -> Result<(), String> { + let mut core = self + .core + .lock() + .map_err(|_| "terminal lock poisoned".to_owned())?; + if core.terminal.clear_screen() { + #[cfg(windows)] + { + core.recent_fallback = windows_recent_fallback::Cache::default(); + windows_recent_fallback::update(&mut core); + } + } + Ok(()) + } + pub fn set_scroll_offset_from_bottom(&self, lines: usize) { if let Ok(mut core) = self.core.lock() { #[cfg(windows)] -- cgit v1.2.3