aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAram Drevekenin <aram@poor.dev>2023-02-27 19:15:45 +0100
committerGitHub <noreply@github.com>2023-02-27 19:15:45 +0100
commitb3b0ddbab82ab74c02dbc991b24f4a3c88f2bcbe (patch)
treedbfb33b8f2a737918a913fc4ef557406708dfa3e
parentdocs(changelog0 (diff)
downloadsl0ppij-b3b0ddbab82ab74c02dbc991b24f4a3c88f2bcbe.tar.gz
sl0ppij-b3b0ddbab82ab74c02dbc991b24f4a3c88f2bcbe.tar.xz
sl0ppij-b3b0ddbab82ab74c02dbc991b24f4a3c88f2bcbe.zip
fix(layouts): do not relayout twice on auto_layout (#2202)
* fix(layouts): do not relayout twice on auto_layout * style(fmt): rustfmt
-rw-r--r--zellij-server/src/panes/tiled_panes/mod.rs38
-rw-r--r--zellij-server/src/tab/layout_applier.rs4
-rw-r--r--zellij-server/src/tab/mod.rs12
-rw-r--r--zellij-server/src/tab/unit/snapshots/zellij_server__tab__tab_integration_tests__can_increase_size_into_pane_stack_non_directionally.snap8
-rw-r--r--zellij-server/src/tab/unit/snapshots/zellij_server__tab__tab_integration_tests__can_increase_size_into_pane_stack_vertically.snap8
-rw-r--r--zellij-server/src/tab/unit/snapshots/zellij_server__tab__tab_integration_tests__can_increase_size_of_main_pane_in_stack_non_directionally.snap8
-rw-r--r--zellij-server/src/tab/unit/snapshots/zellij_server__tab__tab_integration_tests__can_increase_size_of_main_pane_in_stack_vertically.snap8
-rw-r--r--zellij-server/src/tab/unit/snapshots/zellij_server__tab__tab_integration_tests__increasing_size_into_main_pane_in_stack_horizontally_does_not_break_stack.snap12
-rw-r--r--zellij-server/src/tab/unit/snapshots/zellij_server__tab__tab_integration_tests__move_focus_left_into_stacked_panes.snap12
-rw-r--r--zellij-server/src/tab/unit/tab_integration_tests.rs179
10 files changed, 67 insertions, 222 deletions
diff --git a/zellij-server/src/panes/tiled_panes/mod.rs b/zellij-server/src/panes/tiled_panes/mod.rs
index 8ab5cb4f..28941746 100644
--- a/zellij-server/src/panes/tiled_panes/mod.rs
+++ b/zellij-server/src/panes/tiled_panes/mod.rs
@@ -160,7 +160,27 @@ impl TiledPanes {
self.move_clients_between_panes(pane_id, with_pane_id);
removed_pane
}
- pub fn insert_pane(&mut self, pane_id: PaneId, mut pane: Box<dyn Pane>) {
+ pub fn insert_pane(&mut self, pane_id: PaneId, pane: Box<dyn Pane>) {
+ let should_relayout = true;
+ self.add_pane(pane_id, pane, should_relayout);
+ }
+ pub fn insert_pane_without_relayout(&mut self, pane_id: PaneId, pane: Box<dyn Pane>) {
+ let should_relayout = false;
+ self.add_pane(pane_id, pane, should_relayout);
+ }
+ pub fn has_room_for_new_pane(&mut self) -> bool {
+ let cursor_height_width_ratio = self.cursor_height_width_ratio();
+ let pane_grid = TiledPaneGrid::new(
+ &mut self.panes,
+ &self.panes_to_hide,
+ *self.display_area.borrow(),
+ *self.viewport.borrow(),
+ );
+ pane_grid
+ .find_room_for_new_pane(cursor_height_width_ratio)
+ .is_some()
+ }
+ fn add_pane(&mut self, pane_id: PaneId, mut pane: Box<dyn Pane>, should_relayout: bool) {
let cursor_height_width_ratio = self.cursor_height_width_ratio();
let pane_grid = TiledPaneGrid::new(
&mut self.panes,
@@ -178,22 +198,12 @@ impl TiledPanes {
pane_to_split.set_geom(first_geom);
pane.set_geom(second_geom);
self.panes.insert(pane_id, pane);
- self.relayout(!split_direction);
+ if should_relayout {
+ self.relayout(!split_direction);
+ }
}
}
}
- pub fn has_room_for_new_pane(&mut self) -> bool {
- let cursor_height_width_ratio = self.cursor_height_width_ratio();
- let pane_grid = TiledPaneGrid::new(
- &mut self.panes,
- &self.panes_to_hide,
- *self.display_area.borrow(),
- *self.viewport.borrow(),
- );
- pane_grid
- .find_room_for_new_pane(cursor_height_width_ratio)
- .is_some()
- }
pub fn fixed_pane_geoms(&self) -> Vec<Viewport> {
self.panes
.values()
diff --git a/zellij-server/src/tab/layout_applier.rs b/zellij-server/src/tab/layout_applier.rs
index eed7f8c8..b2c3817b 100644
--- a/zellij-server/src/tab/layout_applier.rs
+++ b/zellij-server/src/tab/layout_applier.rs
@@ -609,7 +609,7 @@ impl ExistingTabState {
default_to_closest_position: bool,
) -> Vec<(&PaneId, &Box<dyn Pane>)> {
let mut candidates: Vec<_> = self.existing_panes.iter().collect();
- candidates.sort_by(|(_a_id, a), (_b_id, b)| {
+ candidates.sort_by(|(a_id, a), (b_id, b)| {
let a_invoked_with = a.invoked_with();
let b_invoked_with = b.invoked_with();
if Run::is_same_category(run, a_invoked_with)
@@ -637,7 +637,7 @@ impl ExistingTabState {
let b_y_distance = abs(b.position_and_size().y, position_and_size.y);
(a_x_distance + a_y_distance).cmp(&(b_x_distance + b_y_distance))
} else {
- std::cmp::Ordering::Equal
+ a_id.cmp(&b_id) // just so it's a stable sort
}
}
});
diff --git a/zellij-server/src/tab/mod.rs b/zellij-server/src/tab/mod.rs
index 9e11fdfd..bcd549cc 100644
--- a/zellij-server/src/tab/mod.rs
+++ b/zellij-server/src/tab/mod.rs
@@ -1017,6 +1017,7 @@ impl Tab {
if self.tiled_panes.fullscreen_is_active() {
self.tiled_panes.unset_fullscreen();
}
+ let should_auto_layout = self.auto_layout && !self.swap_layouts.is_tiled_damaged();
if self.tiled_panes.has_room_for_new_pane() {
if let PaneId::Terminal(term_pid) = pid {
let next_terminal_position = self.get_next_terminal_position();
@@ -1035,14 +1036,21 @@ impl Tab {
None,
);
new_terminal.set_active_at(Instant::now());
- self.tiled_panes.insert_pane(pid, Box::new(new_terminal));
+ if should_auto_layout {
+ // no need to relayout here, we'll do it when reapplying the swap layout
+ // below
+ self.tiled_panes
+ .insert_pane_without_relayout(pid, Box::new(new_terminal));
+ } else {
+ self.tiled_panes.insert_pane(pid, Box::new(new_terminal));
+ }
self.should_clear_display_before_rendering = true;
if let Some(client_id) = client_id {
self.tiled_panes.focus_pane(pid, client_id);
}
}
}
- if self.auto_layout && !self.swap_layouts.is_tiled_damaged() {
+ if should_auto_layout {
// only do this if we're already in this layout, otherwise it might be
// confusing and not what the user intends
self.swap_layouts.set_is_tiled_damaged(); // we do this so that we won't skip to the
diff --git a/zellij-server/src/tab/unit/snapshots/zellij_server__tab__tab_integration_tests__can_increase_size_into_pane_stack_non_directionally.snap b/zellij-server/src/tab/unit/snapshots/zellij_server__tab__tab_integration_tests__can_increase_size_into_pane_stack_non_directionally.snap
index 997af6c2..bb6bcaab 100644
--- a/zellij-server/src/tab/unit/snapshots/zellij_server__tab__tab_integration_tests__can_increase_size_into_pane_stack_non_directionally.snap
+++ b/zellij-server/src/tab/unit/snapshots/zellij_server__tab__tab_integration_tests__can_increase_size_into_pane_stack_non_directionally.snap
@@ -1,6 +1,6 @@
---
source: zellij-server/src/tab/./unit/tab_integration_tests.rs
-assertion_line: 4062
+assertion_line: 4299
expression: snapshot
---
00 (C): ┌ Pane #1 ──────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
@@ -17,8 +17,8 @@ expression: snapshot
11 (C): │ │
12 (C): └───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
13 (C): ┌ Pane #2 ────────────────────────────────────────────────────────┐┌ Pane #4 ───────────────────────────────────────────┐
-14 (C): │ │┌ Pane #5 ───────────────────────────────────────────┐
-15 (C): │ │┌ Pane #6 ───────────────────────────────────────────┐
+14 (C): │ │┌ Pane #3 ───────────────────────────────────────────┐
+15 (C): │ │┌ Pane #5 ───────────────────────────────────────────┐
16 (C): │ ││ │
17 (C): │ ││ │
18 (C): │ ││ │
@@ -31,7 +31,7 @@ expression: snapshot
25 (C): │ ││ │
26 (C): │ ││ │
27 (C): └─────────────────────────────────────────────────────────────────┘└────────────────────────────────────────────────────┘
-28 (C): ┌ Pane #3 ──────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
+28 (C): ┌ Pane #6 ──────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
29 (C): │ │
30 (C): │ │
31 (C): │ │
diff --git a/zellij-server/src/tab/unit/snapshots/zellij_server__tab__tab_integration_tests__can_increase_size_into_pane_stack_vertically.snap b/zellij-server/src/tab/unit/snapshots/zellij_server__tab__tab_integration_tests__can_increase_size_into_pane_stack_vertically.snap
index b800c634..644233cd 100644
--- a/zellij-server/src/tab/unit/snapshots/zellij_server__tab__tab_integration_tests__can_increase_size_into_pane_stack_vertically.snap
+++ b/zellij-server/src/tab/unit/snapshots/zellij_server__tab__tab_integration_tests__can_increase_size_into_pane_stack_vertically.snap
@@ -1,6 +1,6 @@
---
source: zellij-server/src/tab/./unit/tab_integration_tests.rs
-assertion_line: 4047
+assertion_line: 4237
expression: snapshot
---
00 (C): ┌ Pane #1 ──────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
@@ -17,8 +17,8 @@ expression: snapshot
11 (C): │ │
12 (C): └───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
13 (C): ┌ Pane #2 ──────────────────────────────────────────────────┐┌ Pane #4 ─────────────────────────────────────────────────┐
-14 (C): │ │┌ Pane #5 ─────────────────────────────────────────────────┐
-15 (C): │ │┌ Pane #6 ─────────────────────────────────────────────────┐
+14 (C): │ │┌ Pane #3 ─────────────────────────────────────────────────┐
+15 (C): │ │┌ Pane #5 ─────────────────────────────────────────────────┐
16 (C): │ ││ │
17 (C): │ ││ │
18 (C): │ ││ │
@@ -28,7 +28,7 @@ expression: snapshot
22 (C): │ ││ │
23 (C): │ ││ │
24 (C): └───────────────────────────────────────────────────────────┘└──────────────────────────────────────────────────────────┘
-25 (C): ┌ Pane #3 ──────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
+25 (C): ┌ Pane #6 ──────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
26 (C): │ │
27 (C): │ │
28 (C): │ │
diff --git a/zellij-server/src/tab/unit/snapshots/zellij_server__tab__tab_integration_tests__can_increase_size_of_main_pane_in_stack_non_directionally.snap b/zellij-server/src/tab/unit/snapshots/zellij_server__tab__tab_integration_tests__can_increase_size_of_main_pane_in_stack_non_directionally.snap
index bcd3b4ee..ac85d9c1 100644
--- a/zellij-server/src/tab/unit/snapshots/zellij_server__tab__tab_integration_tests__can_increase_size_of_main_pane_in_stack_non_directionally.snap
+++ b/zellij-server/src/tab/unit/snapshots/zellij_server__tab__tab_integration_tests__can_increase_size_of_main_pane_in_stack_non_directionally.snap
@@ -1,6 +1,6 @@
---
source: zellij-server/src/tab/./unit/tab_integration_tests.rs
-assertion_line: 3823
+assertion_line: 4024
expression: snapshot
---
00 (C): ┌ Pane #1 ──────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
@@ -17,8 +17,8 @@ expression: snapshot
11 (C): │ │
12 (C): └───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
13 (C): ┌ Pane #2 ───────────────────────────────────────────┐┌ Pane #4 ────────────────────────────────────────────────────────┐
-14 (C): │ │┌ Pane #5 ────────────────────────────────────────────────────────┐
-15 (C): │ │┌ Pane #6 ────────────────────────────────────────────────────────┐
+14 (C): │ │┌ Pane #3 ────────────────────────────────────────────────────────┐
+15 (C): │ │┌ Pane #5 ────────────────────────────────────────────────────────┐
16 (C): │ ││ │
17 (C): │ ││ │
18 (C): │ ││ │
@@ -31,7 +31,7 @@ expression: snapshot
25 (C): │ ││ │
26 (C): │ ││ │
27 (C): └────────────────────────────────────────────────────┘└─────────────────────────────────────────────────────────────────┘
-28 (C): ┌ Pane #3 ──────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
+28 (C): ┌ Pane #6 ──────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
29 (C): │ │
30 (C): │ │
31 (C): │ │
diff --git a/zellij-server/src/tab/unit/snapshots/zellij_server__tab__tab_integration_tests__can_increase_size_of_main_pane_in_stack_vertically.snap b/zellij-server/src/tab/unit/snapshots/zellij_server__tab__tab_integration_tests__can_increase_size_of_main_pane_in_stack_vertically.snap
index b5dea0aa..a18772ac 100644
--- a/zellij-server/src/tab/unit/snapshots/zellij_server__tab__tab_integration_tests__can_increase_size_of_main_pane_in_stack_vertically.snap
+++ b/zellij-server/src/tab/unit/snapshots/zellij_server__tab__tab_integration_tests__can_increase_size_of_main_pane_in_stack_vertically.snap
@@ -1,6 +1,6 @@
---
source: zellij-server/src/tab/./unit/tab_integration_tests.rs
-assertion_line: 3807
+assertion_line: 3961
expression: snapshot
---
00 (C): ┌ Pane #1 ──────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
@@ -17,8 +17,8 @@ expression: snapshot
11 (C): │ │
12 (C): └───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
13 (C): ┌ Pane #2 ──────────────────────────────────────────────────┐┌ Pane #4 ─────────────────────────────────────────────────┐
-14 (C): │ │┌ Pane #5 ─────────────────────────────────────────────────┐
-15 (C): │ │┌ Pane #6 ─────────────────────────────────────────────────┐
+14 (C): │ │┌ Pane #3 ─────────────────────────────────────────────────┐
+15 (C): │ │┌ Pane #5 ─────────────────────────────────────────────────┐
16 (C): │ ││ │
17 (C): │ ││ │
18 (C): │ ││ │
@@ -31,7 +31,7 @@ expression: snapshot
25 (C): │ ││ │
26 (C): │ ││ │
27 (C): └───────────────────────────────────────────────────────────┘└──────────────────────────────────────────────────────────┘
-28 (C): ┌ Pane #3 ──────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
+28 (C): ┌ Pane #6 ──────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
29 (C): │ │
30 (C): │ │
31 (C): │ │
diff --git a/zellij-server/src/tab/unit/snapshots/zellij_server__tab__tab_integration_tests__increasing_size_into_main_pane_in_stack_horizontally_does_not_break_stack.snap b/zellij-server/src/tab/unit/snapshots/zellij_server__tab__tab_integration_tests__increasing_size_into_main_pane_in_stack_horizontally_does_not_break_stack.snap
index 417fe7cd..2302f121 100644
--- a/zellij-server/src/tab/unit/snapshots/zellij_server__tab__tab_integration_tests__increasing_size_into_main_pane_in_stack_horizontally_does_not_break_stack.snap
+++ b/zellij-server/src/tab/unit/snapshots/zellij_server__tab__tab_integration_tests__increasing_size_into_main_pane_in_stack_horizontally_does_not_break_stack.snap
@@ -1,6 +1,6 @@
---
source: zellij-server/src/tab/./unit/tab_integration_tests.rs
-assertion_line: 4178
+assertion_line: 4384
expression: snapshot
---
00 (C): ┌ Pane #1 ──────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
@@ -17,11 +17,11 @@ expression: snapshot
11 (C): │ │
12 (C): └───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
13 (C): ┌ Pane #2 ────────────────────────────────────────────────────────┐┌ Pane #4 ───────────────────────────────────────────┐
-14 (C): │ │┌ Pane #6 ───────────────────────────────────────────┐
-15 (C): │ │┌ Pane #7 ───────────────────────────────────────────┐
-16 (C): │ │┌ Pane #8 ───────────────────────────────────────────┐
+14 (C): │ │┌ Pane #5 ───────────────────────────────────────────┐
+15 (C): │ │┌ Pane #6 ───────────────────────────────────────────┐
+16 (C): │ │┌ Pane #7 ───────────────────────────────────────────┐
17 (C): │ │┌ Pane #9 ───────────────────────────────────────────┐
-18 (C): │ │┌ Pane #10 ──────────────────────────────────────────┐
+18 (C): │ │┌ Pane #8 ───────────────────────────────────────────┐
19 (C): └─────────────────────────────────────────────────────────────────┘┌ Pane #11 ──────────────────────────────────────────┐
20 (C): ┌ Pane #3 ────────────────────────────────────────────────────────┐│ │
21 (C): │ ││ │
@@ -30,7 +30,7 @@ expression: snapshot
24 (C): │ ││ │
25 (C): │ ││ │
26 (C): └─────────────────────────────────────────────────────────────────┘└────────────────────────────────────────────────────┘
-27 (C): ┌ Pane #5 ──────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
+27 (C): ┌ Pane #10 ─────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
28 (C): │ │
29 (C): │ │
30 (C): │ │
diff --git a/zellij-server/src/tab/unit/snapshots/zellij_server__tab__tab_integration_tests__move_focus_left_into_stacked_panes.snap b/zellij-server/src/tab/unit/snapshots/zellij_server__tab__tab_integration_tests__move_focus_left_into_stacked_panes.snap
index 6a0d0d7e..c0f5e10a 100644
--- a/zellij-server/src/tab/unit/snapshots/zellij_server__tab__tab_integration_tests__move_focus_left_into_stacked_panes.snap
+++ b/zellij-server/src/tab/unit/snapshots/zellij_server__tab__tab_integration_tests__move_focus_left_into_stacked_panes.snap
@@ -1,13 +1,13 @@
---
source: zellij-server/src/tab/./unit/tab_integration_tests.rs
-assertion_line: 3378
+assertion_line: 3476
expression: snapshot
---
-00 (C): ┌ Pane #3 ──────────────────────────────────────────────────┐┌ Pane #7 ─────────────────────────────────────────────────┐
-01 (C): ┌ Pane #2 ──────────────────────────────────────────────────┐│ │
-02 (C): ┌ Pane #4 ──────────────────────────────────────────────────┐│ │
-03 (C): ┌ Pane #5 ──────────────────────────────────────────────────┐│ │
-04 (C): ┌ Pane #6 ──────────────────────────────────────────────────┐│ │
+00 (C): ┌ Pane #3 ──────────────────────────────────────────────────┐┌ Pane #2 ─────────────────────────────────────────────────┐
+01 (C): ┌ Pane #4 ──────────────────────────────────────────────────┐│ │
+02 (C): ┌ Pane #5 ──────────────────────────────────────────────────┐│ │
+03 (C): ┌ Pane #6 ──────────────────────────────────────────────────┐│ │
+04 (C): ┌ Pane #7 ──────────────────────────────────────────────────┐│ │
05 (C): ┌ Pane #8 ──────────────────────────────────────────────────┐│ │
06 (C): ┌ Pane #9 ──────────────────────────────────────────────────┐│ │
07 (C): ┌ Pane #10 ─────────────────────────────────────────────────┐│ │
diff --git a/zellij-server/src/tab/unit/tab_integration_tests.rs b/zellij-server/src/tab/unit/tab_integration_tests.rs
index b7823dc1..45b3defd 100644
--- a/zellij-server/src/tab/unit/tab_integration_tests.rs
+++ b/zellij-server/src/tab/unit/tab_integration_tests.rs
@@ -4009,7 +4009,8 @@ fn can_increase_size_of_main_pane_in_stack_non_directionally() {
.unwrap();
tab.new_pane(new_pane_id_5, None, None, Some(client_id))
.unwrap();
- tab.move_focus_right(client_id);
+ let _ = tab.move_focus_up(client_id);
+ let _ = tab.move_focus_right(client_id);
tab.resize(client_id, ResizeStrategy::new(Resize::Increase, None))
.unwrap();
tab.render(&mut output, None).unwrap();
@@ -4023,95 +4024,6 @@ fn can_increase_size_of_main_pane_in_stack_non_directionally() {
}
#[test]
-fn increasing_size_of_main_pane_in_stack_horizontally_does_not_break_stack() {
- // here we test a situation where we're increasing the size of the main pane in a stack
- // while adjacent to this main pane there's another pane perfectly aligned to it
- // if the pane weren't a member of the stack, we would increase into that adjacent pane
- // now, we increase all of the stack also into the panes above said pane
- let size = Size {
- cols: 121,
- rows: 40,
- };
- let client_id = 1;
- let mut output = Output::default();
- let swap_layouts = r#"
- layout {
- swap_tiled_layout {
- tab {
- pane
- pane split_direction="vertical" {
- pane {
- pane focus=true
- pane
- }
- pane stacked=true { children; }
- }
- pane
- }
- }
- }
- "#;
- 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);
- let new_pane_id_4 = PaneId::Terminal(5);
- let new_pane_id_5 = PaneId::Terminal(6);
- let new_pane_id_6 = PaneId::Terminal(7);
- let new_pane_id_7 = PaneId::Terminal(8);
- let new_pane_id_8 = PaneId::Terminal(9);
- let new_pane_id_9 = PaneId::Terminal(10);
- let new_pane_id_10 = PaneId::Terminal(11);
- let new_pane_id_11 = PaneId::Terminal(12);
-
- 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.new_pane(new_pane_id_4, None, None, Some(client_id))
- .unwrap();
- tab.new_pane(new_pane_id_5, None, None, Some(client_id))
- .unwrap();
- tab.new_pane(new_pane_id_6, None, None, Some(client_id))
- .unwrap();
- tab.new_pane(new_pane_id_7, None, None, Some(client_id))
- .unwrap();
- tab.new_pane(new_pane_id_8, None, None, Some(client_id))
- .unwrap();
- tab.new_pane(new_pane_id_9, None, None, Some(client_id))
- .unwrap();
- tab.new_pane(new_pane_id_10, None, None, Some(client_id))
- .unwrap();
- tab.new_pane(new_pane_id_11, None, None, Some(client_id))
- .unwrap();
- tab.move_focus_right(client_id);
- tab.resize(
- client_id,
- ResizeStrategy::new(Resize::Increase, Some(Direction::Left)),
- )
- .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 can_increase_size_into_pane_stack_horizontally() {
let size = Size {
cols: 121,
@@ -4285,7 +4197,7 @@ fn can_increase_size_into_pane_stack_non_directionally() {
.unwrap();
tab.new_pane(new_pane_id_5, None, None, Some(client_id))
.unwrap();
- tab.move_focus_left(client_id);
+ let _ = tab.move_focus_up(client_id);
tab.resize(client_id, ResizeStrategy::new(Resize::Increase, None))
.unwrap();
tab.render(&mut output, None).unwrap();
@@ -4299,91 +4211,6 @@ fn can_increase_size_into_pane_stack_non_directionally() {
}
#[test]
-fn increasing_size_into_main_pane_in_stack_horizontally_does_not_break_stack() {
- // here we test a situation where we're increasing the size of the main pane in a stack
- // while adjacent to this main pane there's another pane perfectly aligned to it
- // if the pane weren't a member of the stack, we would increase into that adjacent pane
- // now, we increase all of the stack also into the panes above said pane
- let size = Size {
- cols: 121,
- rows: 40,
- };
- let client_id = 1;
- let mut output = Output::default();
- let swap_layouts = r#"
- layout {
- swap_tiled_layout {
- tab {
- pane
- pane split_direction="vertical" {
- pane {
- pane focus=true
- pane
- }
- pane stacked=true { children; }
- }
- pane
- }
- }
- }
- "#;
- 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);
- let new_pane_id_4 = PaneId::Terminal(5);
- let new_pane_id_5 = PaneId::Terminal(6);
- let new_pane_id_6 = PaneId::Terminal(7);
- let new_pane_id_7 = PaneId::Terminal(8);
- let new_pane_id_8 = PaneId::Terminal(9);
- let new_pane_id_9 = PaneId::Terminal(10);
- let new_pane_id_10 = PaneId::Terminal(11);
-
- 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.new_pane(new_pane_id_4, None, None, Some(client_id))
- .unwrap();
- tab.new_pane(new_pane_id_5, None, None, Some(client_id))
- .unwrap();
- tab.new_pane(new_pane_id_6, None, None, Some(client_id))
- .unwrap();
- tab.new_pane(new_pane_id_7, None, None, Some(client_id))
- .unwrap();
- tab.new_pane(new_pane_id_8, None, None, Some(client_id))
- .unwrap();
- tab.new_pane(new_pane_id_9, None, None, Some(client_id))
- .unwrap();
- tab.new_pane(new_pane_id_10, None, None, Some(client_id))
- .unwrap();
- tab.resize(
- client_id,
- ResizeStrategy::new(Resize::Increase, Some(Direction::Right)),
- )
- .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 decreasing_size_of_whole_tab_treats_stacked_panes_properly() {
let size = Size {
cols: 121,