diff options
| author | Aram Drevekenin <aram@poor.dev> | 2024-10-24 09:42:15 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-10-24 09:42:15 +0200 |
| commit | bb781eafeda1f73dc9b6a2792e6bbf15b0a18148 (patch) | |
| tree | eca212b933c10f88a269a68ef79faf0a59e89334 | |
| parent | docs(changelog): plugins first-render fix (diff) | |
| download | sl0ppij-bb781eafeda1f73dc9b6a2792e6bbf15b0a18148.tar.gz sl0ppij-bb781eafeda1f73dc9b6a2792e6bbf15b0a18148.tar.xz sl0ppij-bb781eafeda1f73dc9b6a2792e6bbf15b0a18148.zip | |
fix(terminal): recover from partial line drop (#3695)
| -rw-r--r-- | zellij-server/src/panes/grid.rs | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/zellij-server/src/panes/grid.rs b/zellij-server/src/panes/grid.rs index 8a603f4b..b5666f87 100644 --- a/zellij-server/src/panes/grid.rs +++ b/zellij-server/src/panes/grid.rs @@ -705,9 +705,17 @@ impl Grid { let line_to_push_up = if line_to_push_up.is_canonical { line_to_push_up } else { - let mut last_line_above = self.lines_above.pop_back().unwrap(); - last_line_above.append(&mut line_to_push_up.columns); - last_line_above + match self.lines_above.pop_back() { + Some(mut last_line_above) => { + last_line_above.append(&mut line_to_push_up.columns); + last_line_above + }, + None => { + // in this case, this line was not canonical but its beginning line was + // dropped out of scope, so we make it canonical and push it up + line_to_push_up.canonical() + }, + } }; let dropped_line_width = |
