summaryrefslogtreecommitdiffstats
path: root/zellij-server/src/tab
diff options
context:
space:
mode:
authorAram Drevekenin <aram@poor.dev>2023-03-16 17:31:40 +0100
committerGitHub <noreply@github.com>2023-03-16 17:31:40 +0100
commit5cb1cea10c43f0835ac2a114742c1a7eb282788c (patch)
tree00e5368a01627b688095492f4af892e483e0b6be /zellij-server/src/tab
parent2f0b4d048e3b854ece88cd927fda89bd227289c0 (diff)
fix(panes): adding panes to lone stack (#2298)
Diffstat (limited to 'zellij-server/src/tab')
-rw-r--r--zellij-server/src/tab/mod.rs2
-rw-r--r--zellij-server/src/tab/unit/snapshots/zellij_server__tab__tab_integration_tests__swap_tiled_layout_with_only_stacked_children.snap26
-rw-r--r--zellij-server/src/tab/unit/tab_integration_tests.rs47
3 files changed, 73 insertions, 2 deletions
diff --git a/zellij-server/src/tab/mod.rs b/zellij-server/src/tab/mod.rs
index 521e1dbbd..ae3dc52ec 100644
--- a/zellij-server/src/tab/mod.rs
+++ b/zellij-server/src/tab/mod.rs
@@ -1916,8 +1916,6 @@ impl Tab {
self.tiled_panes.focus_previous_pane(client_id);
}
pub fn focus_pane_on_edge(&mut self, direction: Direction, client_id: ClientId) {
- let err_context = || format!("failed to move focus left for client {}", client_id);
-
if self.floating_panes.panes_are_visible() {
self.floating_panes.focus_pane_on_edge(direction, client_id);
} else if self.has_selectable_panes() && !self.tiled_panes.fullscreen_is_active() {
diff --git a/zellij-server/src/tab/unit/snapshots/zellij_server__tab__tab_integration_tests__swap_tiled_layout_with_only_stacked_children.snap b/zellij-server/src/tab/unit/snapshots/zellij_server__tab__tab_integration_tests__swap_tiled_layout_with_only_stacked_children.snap
new file mode 100644
index 000000000..704f019c4
--- /dev/null
+++ b/zellij-server/src/tab/unit/snapshots/zellij_server__tab__tab_integration_tests__swap_tiled_layout_with_only_stacked_children.snap
@@ -0,0 +1,26 @@
+---
+source: zellij-server/src/tab/./unit/tab_integration_tests.rs
+assertion_line: 3253
+expression: snapshot
+---
+00 (C): ┌ Pane #1 ──────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
+01 (C): ┌ Pane #2 ──────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
+02 (C): ┌ Pane #3 ──────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
+03 (C): ┌ Pane #4 ──────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
+04 (C): │ │
+05 (C): │ │
+06 (C): │ │
+07 (C): │ │
+08 (C): │ │
+09 (C): │ │
+10 (C): │ │
+11 (C): │ │
+12 (C): │ │
+13 (C): │ │
+14 (C): │ │
+15 (C): │ │
+16 (C): │ │
+17 (C): │ │
+18 (C): │ │
+19 (C): └───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
+
diff --git a/zellij-server/src/tab/unit/tab_integration_tests.rs b/zellij-server/src/tab/unit/tab_integration_tests.rs
index 1652eb5ae..8ccce263e 100644
--- a/zellij-server/src/tab/unit/tab_integration_tests.rs
+++ b/zellij-server/src/tab/unit/tab_integration_tests.rs
@@ -3207,6 +3207,53 @@ fn swap_tiled_layout_with_stacked_children() {
}
#[test]
+fn swap_tiled_layout_with_only_stacked_children() {
+ let size = Size {
+ cols: 121,
+ rows: 20,
+ };
+ let client_id = 1;
+ let mut output = Output::default();
+ let swap_layouts = r#"
+ layout {
+ swap_tiled_layout {
+ tab {
+ pane stacked=true { children; }
+ }
+ }
+ }
+ "#;
+ let layout = Layout::from_kdl(swap_layouts, "file_name.kdl".into(), None, None).unwrap();
+ let swap_tiled_layouts = layout.swap_tiled_layouts.clone();
+ let swap_floating_layouts = layout.swap_floating_layouts.clone();
+ let mut tab = create_new_tab_with_swap_layouts(
+ size,
+ ModeInfo::default(),
+ (swap_tiled_layouts, swap_floating_layouts),
+ None,
+ true,
+ );
+ let new_pane_id_1 = PaneId::Terminal(2);
+ let new_pane_id_2 = PaneId::Terminal(3);
+ let new_pane_id_3 = PaneId::Terminal(4);
+
+ tab.new_pane(new_pane_id_1, None, None, Some(client_id))
+ .unwrap();
+ tab.new_pane(new_pane_id_2, None, None, Some(client_id))
+ .unwrap();
+ tab.new_pane(new_pane_id_3, None, None, Some(client_id))
+ .unwrap();
+ tab.render(&mut output, None).unwrap();
+ let snapshot = take_snapshot(
+ output.serialize().unwrap().get(&client_id).unwrap(),
+ size.rows,
+ size.cols,
+ Palette::default(),
+ );
+ assert_snapshot!(snapshot);
+}
+
+#[test]
fn swap_tiled_layout_with_stacked_children_and_no_pane_frames() {
let size = Size {
cols: 121,