diff options
author | Burak Yigit Kaya <ben@byk.im> | 2019-11-14 02:36:54 +0300 |
---|---|---|
committer | Christian Duerr <contact@christianduerr.com> | 2019-11-14 00:36:54 +0100 |
commit | 561063b5606746936ee64d2f25a8b49c05a8d52e (patch) | |
tree | d5999b01b367d2eae8b2b55914290160666ead6f /alacritty_terminal/src/term/mod.rs | |
parent | d707e064a97532b36c68088ba44cd8a10f6f71dc (diff) | |
download | alacritty-561063b5606746936ee64d2f25a8b49c05a8d52e.tar.gz alacritty-561063b5606746936ee64d2f25a8b49c05a8d52e.zip |
Fix division by zero without any cols or lines
The URL check uses a division to wrap column indices across lines, which
will cause a runtime error if the size of the terminal is zero columns
wide.
Since a lot of our logic assumes that we at least have one column and
line to work with and our behavior doesn't matter otherwise, this change
fixes the terminal dimensions to have space for at least one cell.
Diffstat (limited to 'alacritty_terminal/src/term/mod.rs')
-rw-r--r-- | alacritty_terminal/src/term/mod.rs | 7 |
1 files changed, 0 insertions, 7 deletions
diff --git a/alacritty_terminal/src/term/mod.rs b/alacritty_terminal/src/term/mod.rs index 858402a4..063897cf 100644 --- a/alacritty_terminal/src/term/mod.rs +++ b/alacritty_terminal/src/term/mod.rs @@ -1023,13 +1023,6 @@ impl<T> Term<T> { /// Resize terminal to new dimensions pub fn resize(&mut self, size: &SizeInfo) { - // Bounds check; lots of math assumes width and height are > 0 - if size.width as usize <= 2 * size.padding_x as usize - || size.height as usize <= 2 * size.padding_y as usize - { - return; - } - let old_cols = self.grid.num_cols(); let old_lines = self.grid.num_lines(); let mut num_cols = size.cols(); |