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<Target = Surface>, 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.
This commit is contained in:
1 parent
28709e0493
commit
374b4dca90
1 file changed
+5
@@ -38,6 +38,11 @@ impl<T: Terminal> BufferedTerminal<T> {
|
||||
&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`.
|
||||
|
||||
Reference in new issue
Block a user