From 90cd3b5e874907782756b7f12b30ae0f7e1697de Mon Sep 17 00:00:00 2001 From: Conrad Irwin Date: Tue, 6 Feb 2024 20:25:02 -0700 Subject: [PATCH] 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)). --- crates/terminal_view/src/terminal_element.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/crates/terminal_view/src/terminal_element.rs b/crates/terminal_view/src/terminal_element.rs index 66ef42bc46..7ddb5ad988 100644 --- a/crates/terminal_view/src/terminal_element.rs +++ b/crates/terminal_view/src/terminal_element.rs @@ -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) };