diff --git a/helix-term/src/compositor.rs b/helix-term/src/compositor.rs index 2c0c1c119..c02727f82 100644 --- a/helix-term/src/compositor.rs +++ b/helix-term/src/compositor.rs @@ -75,6 +75,7 @@ type Terminal = tui::terminal::Terminal>; pub struct Compositor { layers: Vec>, terminal: Terminal, + area: Rect, pub(crate) last_picker: Option>, } @@ -83,21 +84,25 @@ impl Compositor { pub fn new() -> Result { let backend = CrosstermBackend::new(stdout()); let terminal = Terminal::new(backend)?; + let area = terminal.size().expect("couldn't get terminal size"); Ok(Self { layers: Vec::new(), + area, terminal, last_picker: None, }) } pub fn size(&self) -> Rect { - self.terminal.size().expect("couldn't get terminal size") + self.area } pub fn resize(&mut self, width: u16, height: u16) { self.terminal .resize(Rect::new(0, 0, width, height)) - .expect("Unable to resize terminal") + .expect("Unable to resize terminal"); + + self.area = self.terminal.size().expect("couldn't get terminal size"); } pub fn save_cursor(&mut self) {