From 5db749c258dfb1eb55b5bf1320399e317a02a836 Mon Sep 17 00:00:00 2001 From: Manos Pitsidianakis Date: Sun, 2 Aug 2020 16:40:50 +0300 Subject: [PATCH] terminal/cells.rs: fix resize to grow actually making the grid smaller --- src/terminal/cells.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/terminal/cells.rs b/src/terminal/cells.rs index 3e187a49..62ea8a13 100644 --- a/src/terminal/cells.rs +++ b/src/terminal/cells.rs @@ -1796,7 +1796,11 @@ macro_rules! inspect_bounds { let (upper_left, bottom_right) = $area; if $x > (get_x(bottom_right)) || $x >= get_x(bounds) { if $grid.growable { - $grid.resize($x + 1, $grid.rows, Cell::default()); + $grid.resize( + std::cmp::max($x + 1, $grid.cols), + $grid.rows, + Cell::default(), + ); } else { $x = get_x(upper_left); $y += 1; @@ -1809,7 +1813,11 @@ macro_rules! inspect_bounds { } if $y > (get_y(bottom_right)) || $y >= get_y(bounds) { if $grid.growable { - $grid.resize($grid.cols, $y + 1, Cell::default()); + $grid.resize( + $grid.cols, + std::cmp::max($y + 1, $grid.rows), + Cell::default(), + ); } else { return ($x, $y - 1); }