diff options
author | Eike Christian Karbe <38853513+ekarbe@users.noreply.github.com> | 2019-04-18 00:42:27 +0200 |
---|---|---|
committer | Christian Duerr <chrisduerr@users.noreply.github.com> | 2019-04-17 22:42:27 +0000 |
commit | ab8fddd5938024beca3a97eab9022db07f675a3c (patch) | |
tree | 90db505768fe8e0998f7a9babd1960353419b5cb | |
parent | 5174f9b27488902e7862aeb470aa0f0375c95e46 (diff) | |
download | alacritty-ab8fddd5938024beca3a97eab9022db07f675a3c.tar.gz alacritty-ab8fddd5938024beca3a97eab9022db07f675a3c.zip |
Call TIOCSWINSZ only on grid change
Instead of calling TIOCSWINSZ for every pixel change it will now be called only on changes to the grid size. This should reduce screen refreshes.
This fixes #2177.
-rw-r--r-- | CHANGELOG.md | 1 | ||||
-rw-r--r-- | src/display.rs | 7 |
2 files changed, 7 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 74a97501..eceaa3ec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Subprocess spawning on macos - Unnecessary resize at startup - Text getting blurry after live-reloading shaders with padding active +- Resize events are not send to the shell anymore if dimensions haven't changed ## Version 0.3.0 diff --git a/src/display.rs b/src/display.rs index ed88f957..58c58e3a 100644 --- a/src/display.rs +++ b/src/display.rs @@ -388,6 +388,8 @@ impl Display { let height = psize.height as f32; let cell_width = self.size_info.cell_width; let cell_height = self.size_info.cell_height; + let previous_cols = self.size_info.cols(); + let previous_lines = self.size_info.lines(); self.size_info.width = width; self.size_info.height = height; @@ -412,7 +414,10 @@ impl Display { if let Some(message) = terminal.message_buffer_mut().message() { pty_size.height -= pty_size.cell_height * message.text(&size).len() as f32; } - pty_resize_handle.on_resize(&pty_size); + + if previous_cols != size.cols() || previous_lines != size.lines() { + pty_resize_handle.on_resize(&pty_size); + } self.window.resize(psize); self.renderer.resize(psize, self.size_info.padding_x, self.size_info.padding_y); |