From b4e113c6a424ba9800abab79de378edadde4f0cb Mon Sep 17 00:00:00 2001 From: Aram Drevekenin Date: Wed, 30 Mar 2022 09:48:41 +0200 Subject: [PATCH] fix(compatibility): don't crash on invalid state when padding line (#1285) --- zellij-server/src/panes/grid.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/zellij-server/src/panes/grid.rs b/zellij-server/src/panes/grid.rs index 63b02684..e9058099 100644 --- a/zellij-server/src/panes/grid.rs +++ b/zellij-server/src/panes/grid.rs @@ -1066,6 +1066,9 @@ impl Grid { } fn pad_current_line_until(&mut self, position: usize) { + if self.viewport.get(self.cursor.y).is_none() { + self.pad_lines_until(self.cursor.y, EMPTY_TERMINAL_CHARACTER); + } let current_row = self.viewport.get_mut(self.cursor.y).unwrap(); for _ in current_row.width()..position { current_row.push(EMPTY_TERMINAL_CHARACTER);