Prevent terminal being a single column wide (#7471)

Fixes: #2750
Fixes: #7457



Release Notes:

- Fixed a hang/panic that could happen rendering a double-width
character in a single-width terminal
([#2750](https://github.com/zed-industries/zed/issues/2750),
[#7457](https://github.com/zed-industries/zed/issues/7457)).
This commit is contained in:
Conrad Irwin 2024-02-06 20:25:02 -07:00 committed by GitHub
parent 1264e36429
commit 90cd3b5e87
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -450,6 +450,13 @@ impl TerminalElement {
let mut size = bounds.size.clone();
size.width -= gutter;
// https://github.com/zed-industries/zed/issues/2750
// if the terminal is one column wide, rendering 🦀
// causes alacritty to misbehave.
if size.width < cell_width * 2.0 {
size.width = cell_width * 2.0;
}
TerminalSize::new(line_height, cell_width, size)
};