fix: prevent crash when splits are resized too small

This commit is contained in:
Hojjat 2026-03-19 00:10:26 -06:00 committed by Jacob Kauffmann
parent 661d30b567
commit 9ed56eb2db
2 changed files with 34 additions and 3 deletions

View file

@ -437,8 +437,12 @@ impl Terminal {
if width != self.size.width || height != self.size.height {
let instant = Instant::now();
self.size.width = width;
self.size.height = height;
// Clamp dimensions to ensure at least 1 row and 1 column,
// preventing index-out-of-bounds panics in alacritty_terminal.
let min_width = self.size.cell_width.ceil() as u32;
let min_height = self.size.cell_height.ceil() as u32;
self.size.width = width.max(min_width);
self.size.height = height.max(min_height);
self.notifier.on_resize(self.size.into());
self.term.lock().resize(self.size);