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
This commit is contained in:
har7an 2022-09-23 05:28:35 +00:00 committed by GitHub
parent 480086e3d4
commit 77f05f0f12
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 1 deletions

View File

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

View File

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

View File

@ -192,6 +192,25 @@ fn create_new_tab_with_cell_size(
tab
}
#[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 {