1
1
mirror of https://github.com/wez/wezterm.git synced 2024-12-24 13:52:55 +03:00

Fix divide by zero when resizing lots of tiny panes

refs: #3921
This commit is contained in:
Wez Furlong 2023-07-09 13:10:18 -07:00
parent f09992f704
commit c2f1be53ba
No known key found for this signature in database
GPG Key ID: 7A7F66A31EC9B387
2 changed files with 9 additions and 2 deletions

View File

@ -114,6 +114,7 @@ As features stabilize some brief notes about them will accumulate here.
immediately with the default `exit_behavior` setting. Now ssh sessions
override `exit_behavior="CloseOnCleanExit"` while connecting so that error
information can be displayed. #3941
* Divide by zero panic with lots of splits and resizing panes. #3921
#### Updated
* Bundled harfbuzz to 8.0.0

View File

@ -1177,8 +1177,14 @@ impl TabInner {
}
fn apply_pane_size(&mut self, pane_size: TerminalSize, cursor: &mut Cursor) {
let cell_width = pane_size.pixel_width / pane_size.cols;
let cell_height = pane_size.pixel_height / pane_size.rows;
let cell_width = pane_size
.pixel_width
.checked_div(pane_size.cols)
.unwrap_or(1);
let cell_height = pane_size
.pixel_height
.checked_div(pane_size.rows)
.unwrap_or(1);
if let Ok(Some(node)) = cursor.node_mut() {
// Adjust the size of the node; we preserve the size of the first
// child and adjust the second, so if we are split down the middle