fix(compatibility): don't crash on invalid state when padding line (#1285)
This commit is contained in:
parent
8ab6873ba6
commit
b4e113c6a4
1 changed files with 3 additions and 0 deletions
|
|
@ -1066,6 +1066,9 @@ impl Grid {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn pad_current_line_until(&mut self, position: usize) {
|
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();
|
let current_row = self.viewport.get_mut(self.cursor.y).unwrap();
|
||||||
for _ in current_row.width()..position {
|
for _ in current_row.width()..position {
|
||||||
current_row.push(EMPTY_TERMINAL_CHARACTER);
|
current_row.push(EMPTY_TERMINAL_CHARACTER);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue