From 374b4dca90e29c474954a8eab6dba1cd1998fd39 Mon Sep 17 00:00:00 2001 From: Josh McKinney Date: Sun, 22 Nov 2026 06:46:01 -0800 Subject: [PATCH] termwiz: add BufferedTerminal::terminal_ref The only way to reach the terminal inside a BufferedTerminal was terminal(&mut self), so code holding a shared reference could not ask it for anything, including its size. dimensions(), reached through Deref, is the size of the cached surface and only changes when check_for_resize is called. terminal_ref(&self) is the shared-reference counterpart to terminal(), so callers can use the now &self Terminal::get_screen_size to get the real size. --- termwiz/src/terminal/buffered.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/termwiz/src/terminal/buffered.rs b/termwiz/src/terminal/buffered.rs index 66f0c83e7..d7bdac554 100644 --- a/termwiz/src/terminal/buffered.rs +++ b/termwiz/src/terminal/buffered.rs @@ -38,6 +38,11 @@ impl BufferedTerminal { &mut self.terminal } + /// Get a reference to the underlying terminal instance + pub fn terminal_ref(&self) -> &T { + &self.terminal + } + /// Compute the set of changes needed to update the screen to /// match the current contents of the embedded `Surface` and /// send them to the `Terminal`.