aboutsummaryrefslogtreecommitdiff
path: root/helix-term
diff options
context:
space:
mode:
authorBlaž Hrastnik2022-03-29 00:57:12 +0000
committerBlaž Hrastnik2022-11-09 12:37:56 +0000
commitb2e7171fedd501f2d804f95ed7eaf476d5e352ed (patch)
treee6c796b1bda72dfe073611141008776c71724922 /helix-term
parentd4f5cab7b53d4e10cc1907156876441744eff646 (diff)
Drop terminal interaction in compositor.size()
Diffstat (limited to 'helix-term')
-rw-r--r--helix-term/src/compositor.rs9
1 files changed, 7 insertions, 2 deletions
diff --git a/helix-term/src/compositor.rs b/helix-term/src/compositor.rs
index 971dc52d..ad1a29ab 100644
--- a/helix-term/src/compositor.rs
+++ b/helix-term/src/compositor.rs
@@ -93,6 +93,7 @@ type Terminal = tui::terminal::Terminal<TestBackend>;
pub struct Compositor {
layers: Vec<Box<dyn Component>>,
terminal: Terminal,
+ area: Rect,
pub(crate) last_picker: Option<Box<dyn Component>>,
}
@@ -106,21 +107,25 @@ impl Compositor {
let backend = TestBackend::new(120, 150);
let terminal = Terminal::new(backend).context("build terminal")?;
+ 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) {