Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'helix-tui/src/terminal.rs')
| -rw-r--r-- | helix-tui/src/terminal.rs | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/helix-tui/src/terminal.rs b/helix-tui/src/terminal.rs index 5e4007fc..72f38d71 100644 --- a/helix-tui/src/terminal.rs +++ b/helix-tui/src/terminal.rs @@ -73,14 +73,6 @@ where viewport: Viewport, } -/// Default terminal size: 80 columns, 24 lines -pub const DEFAULT_TERMINAL_SIZE: Rect = Rect { - x: 0, - y: 0, - width: 80, - height: 24, -}; - impl<B> Terminal<B> where B: Backend, @@ -88,7 +80,7 @@ where /// Wrapper around Terminal initialization. Each buffer is initialized with a blank string and /// default colors for the foreground and the background pub fn new(backend: B) -> io::Result<Terminal<B>> { - let size = backend.size().unwrap_or(DEFAULT_TERMINAL_SIZE); + let size = backend.size()?; Terminal::with_options( backend, TerminalOptions { @@ -167,7 +159,7 @@ where /// Queries the backend for size and resizes if it doesn't match the previous size. pub fn autoresize(&mut self) -> io::Result<Rect> { - let size = self.size(); + let size = self.size()?; if size != self.viewport.area { self.resize(size)?; }; @@ -243,7 +235,7 @@ where } /// Queries the real size of the backend. - pub fn size(&self) -> Rect { - self.backend.size().unwrap_or(DEFAULT_TERMINAL_SIZE) + pub fn size(&self) -> io::Result<Rect> { + self.backend.size() } } |