@@ -93,6 +93,7 @@ type Terminal = tui::terminal::Terminal<TestBackend>;
9393pub struct Compositor {
9494 layers: Vec<Box<dyn Component>>,
9595 terminal: Terminal,
96+ area: Rect,
9697
9798 pub(crate) last_picker: Option<Box<dyn Component>>,
9899}
@@ -106,21 +107,25 @@ impl Compositor {
106107 let backend = TestBackend::new(120, 150);
107108
108109 let terminal = Terminal::new(backend).context("build terminal")?;
110+ let area = terminal.size().expect("couldn't get terminal size");
109111 Ok(Self {
110112 layers: Vec::new(),
113+ area,
111114 terminal,
112115 last_picker: None,
113116 })
114117 }
115118
116119 pub fn size(&self) -> Rect {
117− self.terminal.size().expect("couldn't get terminal size")
120+ self.area
118121 }
119122
120123 pub fn resize(&mut self, width: u16, height: u16) {
121124 self.terminal
122125 .resize(Rect::new(0, 0, width, height))
123− .expect("Unable to resize terminal")
126+ .expect("Unable to resize terminal");
127+
128+ self.area = self.terminal.size().expect("couldn't get terminal size");
124129 }
125130
126131 pub fn save_cursor(&mut self) {