fix(compatibility): don't crash on invalid state when padding line (#1285)

This commit is contained in:
Aram Drevekenin 2022-03-30 09:48:41 +02:00 committed by GitHub
parent 8ab6873ba6
commit b4e113c6a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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);