Skip to content

Commit

Permalink
autoresize terminal in compositor render
Browse files Browse the repository at this point in the history
  • Loading branch information
janhrastnik committed Jun 2, 2021
1 parent c2e6b9f commit 78980f5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 2 additions & 0 deletions helix-term/src/compositor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,9 @@ impl Compositor {
}

pub fn render(&mut self, cx: &mut Context) {
self.terminal.autoresize().unwrap();
let area = self.size();

let surface = self.terminal.current_buffer_mut();

for layer in &self.layers {
Expand Down
8 changes: 3 additions & 5 deletions helix-tui/src/terminal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,9 @@ where

/// Queries the backend for size and resizes if it doesn't match the previous size.
pub fn autoresize(&mut self) -> io::Result<()> {
if self.viewport.resize_behavior == ResizeBehavior::Auto {
let size = self.size()?;
if size != self.viewport.area {
self.resize(size)?;
}
let size = self.size()?;
if size != self.viewport.area {
self.resize(size)?;
};
Ok(())
}
Expand Down

0 comments on commit 78980f5

Please sign in to comment.