diff options
author | har7an <99636919+har7an@users.noreply.github.com> | 2022-09-23 05:28:35 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-23 05:28:35 +0000 |
commit | 77f05f0f12c91df1667e43218074b74dd14c2cf9 (patch) | |
tree | 1a7e06873714a6f3be333184211b5c005d09b8b4 | |
parent | 480086e3d456cb4984c70f50f7290fc06ad5b60a (diff) |
Fix: issue 1734 (#1749)
* server/tab: Check suppressed panes
when writing to a pane by ID. Previously only the tiled and floating
panes would be searched for a pane of a given ID.
Fixes: #1734
* server/tab/unit: Test writing to suppressed panes
* docs: fix server panics when writing to suppressed panes
-rw-r--r-- | CHANGELOG.md | 1 | ||||
-rw-r--r-- | zellij-server/src/tab/mod.rs | 4 | ||||
-rw-r--r-- | zellij-server/src/tab/unit/tab_tests.rs | 19 |
3 files changed, 23 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 2931e5dc4..9051bc8ca 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) * debugging: Improve error handling in screen thread (https://github.com/zellij-org/zellij/pull/1670) * fix: Server exits when client panics (https://github.com/zellij-org/zellij/pull/1731) +* fix: Server panics when writing to suppressed pane (https://github.com/zellij-org/zellij/pull/1749) ## [0.31.4] - 2022-09-09 * Terminal compatibility: improve vttest compliance (https://github.com/zellij-org/zellij/pull/1671) diff --git a/zellij-server/src/tab/mod.rs b/zellij-server/src/tab/mod.rs index 04626bef8..31f3fa1c7 100644 --- a/zellij-server/src/tab/mod.rs +++ b/zellij-server/src/tab/mod.rs @@ -1032,7 +1032,9 @@ impl Tab { let active_terminal = self .floating_panes .get(&pane_id) - .unwrap_or_else(|| self.tiled_panes.get_pane(pane_id).unwrap()); + .or_else(|| self.tiled_panes.get_pane(pane_id)) + .or_else(|| self.suppressed_panes.get(&pane_id)) + .unwrap(); let adjusted_input = active_terminal.adjust_input_to_terminal(input_bytes); self.senders diff --git a/zellij-server/src/tab/unit/tab_tests.rs b/zellij-server/src/tab/unit/tab_tests.rs index 2ca6a0cb1..8a3072500 100644 --- a/zellij-server/src/tab/unit/tab_tests.rs +++ b/zellij-server/src/tab/unit/tab_tests.rs @@ -193,6 +193,25 @@ fn create_new_tab_with_cell_size( } #[test] +fn write_to_suppressed_pane() { + let size = Size { + cols: 121, + rows: 20, + }; + let mut tab = create_new_tab(size); + tab.vertical_split(PaneId::Terminal(2), 1); + + // Suppress pane 2 and remove it from active panes + tab.suppress_active_pane(PaneId::Terminal(2), 1); + tab.tiled_panes.remove_pane(PaneId::Terminal(2)); + + // Make sure it's suppressed now + tab.suppressed_panes.get(&PaneId::Terminal(2)).unwrap(); + // Write content to it + tab.write_to_pane_id(vec![34, 127, 31, 82, 17, 182], PaneId::Terminal(2)); +} + +#[test] fn split_panes_vertically() { let size = Size { cols: 121, |