@@ -93,6 +93,7 @@ type Terminal = tui::terminal::Terminal<TestBackend>;
93pub struct Compositor {
93pub struct Compositor {
94 layers: Vec<Box<dyn Component>>,
94 layers: Vec<Box<dyn Component>>,
95 terminal: Terminal,
95 terminal: Terminal,
97 pub(crate) last_picker: Option<Box<dyn Component>>,
98 pub(crate) last_picker: Option<Box<dyn Component>>,
@@ -106,21 +107,25 @@ impl Compositor {
106 let backend = TestBackend::new(120, 150);
107 let backend = TestBackend::new(120, 150);
108 let terminal = Terminal::new(backend).context("build terminal")?;
109 let terminal = Terminal::new(backend).context("build terminal")?;
110+ let area = terminal.size().expect("couldn't get terminal size");
109 Ok(Self {
111 Ok(Self {
110 layers: Vec::new(),
112 layers: Vec::new(),
111 terminal,
114 terminal,
112 last_picker: None,
115 last_picker: None,
116 pub fn size(&self) -> Rect {
119 pub fn size(&self) -> Rect {
117− self.terminal.size().expect("couldn't get terminal size")
120+ self.area
120 pub fn resize(&mut self, width: u16, height: u16) {
123 pub fn resize(&mut self, width: u16, height: u16) {
121 self.terminal
124 self.terminal
122 .resize(Rect::new(0, 0, width, height))
125 .resize(Rect::new(0, 0, width, height))
123− .expect("Unable to resize terminal")
126+ .expect("Unable to resize terminal");
128+ self.area = self.terminal.size().expect("couldn't get terminal size");
126 pub fn save_cursor(&mut self) {
131 pub fn save_cursor(&mut self) {