Merge pull request #55 from helix-editor/autoresize

autoresize terminal in compositor render
This commit is contained in:
Blaž Hrastnik 2021-06-02 22:45:43 +09:00 committed by GitHub
commit 2719a35123
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 5 deletions

View file

@ -122,7 +122,9 @@ impl Compositor {
} }
pub fn render(&mut self, cx: &mut Context) { pub fn render(&mut self, cx: &mut Context) {
self.terminal.autoresize().unwrap();
let area = self.size(); let area = self.size();
let surface = self.terminal.current_buffer_mut(); let surface = self.terminal.current_buffer_mut();
for layer in &self.layers { for layer in &self.layers {

View file

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