summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAram Drevekenin <aram@poor.dev>2023-06-19 18:09:08 +0200
committerGitHub <noreply@github.com>2023-06-19 18:09:08 +0200
commit1280cc8d73ee1e33b621589dc1e3e96efac80d1d (patch)
tree2157d22e9d968e863e214835c8882288495ecc32
parent0adb10573dd59a5c9f851592e4637f750001e999 (diff)
fix(plugins): swap layouts and invoked_with (#2564)
-rw-r--r--zellij-server/src/panes/terminal_pane.rs1
-rw-r--r--zellij-server/src/plugins/zellij_exports.rs12
-rw-r--r--zellij-server/src/tab/unit/snapshots/zellij_server__tab__tab_integration_tests__floating_layout_with_plugins_and_commands_swaped_properly.snap6
-rw-r--r--zellij-server/src/tab/unit/snapshots/zellij_server__tab__tab_integration_tests__layout_with_plugins_and_commands_swaped_properly.snap10
-rw-r--r--zellij-server/src/tab/unit/snapshots/zellij_server__tab__tab_integration_tests__swap_floating_layouts_not_including_plugin_panes_present_in_existing_layout.snap10
5 files changed, 22 insertions, 17 deletions
diff --git a/zellij-server/src/panes/terminal_pane.rs b/zellij-server/src/panes/terminal_pane.rs
index a01d815b5..d522a400f 100644
--- a/zellij-server/src/panes/terminal_pane.rs
+++ b/zellij-server/src/panes/terminal_pane.rs
@@ -697,6 +697,7 @@ impl Pane for TerminalPane {
self.grid.is_alternate_mode_active()
}
fn hold(&mut self, exit_status: Option<i32>, is_first_run: bool, run_command: RunCommand) {
+ self.invoked_with = Some(Run::Command(run_command.clone()));
self.is_held = Some((exit_status, is_first_run, run_command));
if is_first_run {
self.render_first_run_banner();
diff --git a/zellij-server/src/plugins/zellij_exports.rs b/zellij-server/src/plugins/zellij_exports.rs
index 403d8cedb..e4d85a116 100644
--- a/zellij-server/src/plugins/zellij_exports.rs
+++ b/zellij-server/src/plugins/zellij_exports.rs
@@ -588,21 +588,25 @@ fn host_new_tabs_with_layout(env: &ForeignFunctionEnv) {
let mut tabs_to_open = vec![];
let tabs = layout.tabs();
if tabs.is_empty() {
+ let swap_tiled_layouts = Some(layout.swap_tiled_layouts.clone());
+ let swap_floating_layouts = Some(layout.swap_floating_layouts.clone());
let action = Action::NewTab(
layout.template.as_ref().map(|t| t.0.clone()),
layout.template.map(|t| t.1).unwrap_or_default(),
- None,
- None,
+ swap_tiled_layouts,
+ swap_floating_layouts,
None,
);
tabs_to_open.push(action);
} else {
for (tab_name, tiled_pane_layout, floating_pane_layout) in layout.tabs() {
+ let swap_tiled_layouts = Some(layout.swap_tiled_layouts.clone());
+ let swap_floating_layouts = Some(layout.swap_floating_layouts.clone());
let action = Action::NewTab(
Some(tiled_pane_layout),
floating_pane_layout,
- None,
- None,
+ swap_tiled_layouts,
+ swap_floating_layouts,
tab_name,
);
tabs_to_open.push(action);
diff --git a/zellij-server/src/tab/unit/snapshots/zellij_server__tab__tab_integration_tests__floating_layout_with_plugins_and_commands_swaped_properly.snap b/zellij-server/src/tab/unit/snapshots/zellij_server__tab__tab_integration_tests__floating_layout_with_plugins_and_commands_swaped_properly.snap
index 11b9b6693..398383482 100644
--- a/zellij-server/src/tab/unit/snapshots/zellij_server__tab__tab_integration_tests__floating_layout_with_plugins_and_commands_swaped_properly.snap
+++ b/zellij-server/src/tab/unit/snapshots/zellij_server__tab__tab_integration_tests__floating_layout_with_plugins_and_commands_swaped_properly.snap
@@ -1,6 +1,6 @@
---
source: zellij-server/src/tab/./unit/tab_integration_tests.rs
-assertion_line: 5402
+assertion_line: 5926
expression: snapshot
---
00 (C): ┌ status-bar ──────────────────────────────────────────────┐─────────────────────────────────────────────────┐──────────┐
@@ -13,11 +13,11 @@ expression: snapshot
07 (C): │ │ │ │
08 (C): │ │ │ │
09 (C): └──────────────────────────────────────────────────────────┘─────────────────────────────────────────────────┘ │
-10 (C): ┌ command2 ───────────────────│ ┌ command1 ────────────────────────────────────────────────┐ │
+10 (C): ┌ command1 ───────────────────│ ┌ command2 ────────────────────────────────────────────────┐ │
11 (C): │ │ │ │ │
12 (C): │ │ │ │ │
13 (C): │ │ │ │ │
-14 (C): │ Waiting to ru└───────────────────│ Waiting to run: command1 │ │
+14 (C): │ Waiting to ru└───────────────────│ Waiting to run: command2 │ │
15 (C): │ │ │ │
16 (C): │ <ENTER> to run, <Ctrl-c> to exit │ <ENTER> to run, <Ctrl-c> to exit │ │
17 (C): │ │ │ │
diff --git a/zellij-server/src/tab/unit/snapshots/zellij_server__tab__tab_integration_tests__layout_with_plugins_and_commands_swaped_properly.snap b/zellij-server/src/tab/unit/snapshots/zellij_server__tab__tab_integration_tests__layout_with_plugins_and_commands_swaped_properly.snap
index 6be12af67..c02cd98ca 100644
--- a/zellij-server/src/tab/unit/snapshots/zellij_server__tab__tab_integration_tests__layout_with_plugins_and_commands_swaped_properly.snap
+++ b/zellij-server/src/tab/unit/snapshots/zellij_server__tab__tab_integration_tests__layout_with_plugins_and_commands_swaped_properly.snap
@@ -1,19 +1,19 @@
---
source: zellij-server/src/tab/./unit/tab_integration_tests.rs
-assertion_line: 4689
+assertion_line: 4992
expression: snapshot
---
00 (C): I am a
01 (C): status bar
-02 (C): ┌ command2 ─────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
+02 (C): ┌ command1 ─────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
03 (C): │ │
-04 (C): │ Waiting to run: command2 │
+04 (C): │ Waiting to run: command1 │
05 (C): │ │
06 (C): │ <ENTER> to run, <Ctrl-c> to exit │
07 (C): └───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
-08 (C): ┌ command1 ─────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
+08 (C): ┌ command2 ─────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
09 (C): │ │
-10 (C): │ Waiting to run: command1 │
+10 (C): │ Waiting to run: command2 │
11 (C): │ │
12 (C): │ <ENTER> to run, <Ctrl-c> to exit │
13 (C): └───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
diff --git a/zellij-server/src/tab/unit/snapshots/zellij_server__tab__tab_integration_tests__swap_floating_layouts_not_including_plugin_panes_present_in_existing_layout.snap b/zellij-server/src/tab/unit/snapshots/zellij_server__tab__tab_integration_tests__swap_floating_layouts_not_including_plugin_panes_present_in_existing_layout.snap
index e6baccbe0..278676fa2 100644
--- a/zellij-server/src/tab/unit/snapshots/zellij_server__tab__tab_integration_tests__swap_floating_layouts_not_including_plugin_panes_present_in_existing_layout.snap
+++ b/zellij-server/src/tab/unit/snapshots/zellij_server__tab__tab_integration_tests__swap_floating_layouts_not_including_plugin_panes_present_in_existing_layout.snap
@@ -1,6 +1,6 @@
---
source: zellij-server/src/tab/./unit/tab_integration_tests.rs
-assertion_line: 5734
+assertion_line: 6363
expression: snapshot
---
00 (C): ┌ Pane #1 ──────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
@@ -8,10 +8,10 @@ expression: snapshot
02 (C): │ │
03 (C): │ │
04 (C): │ │
-05 (C): │ ┌ Pane #2 ─────────────────────────────────────────────────┐ │
-06 (C): │ │ │ │
-07 (C): │ │ ┌ tab-bar ─────────────────────────────────────────────────┐ │
-08 (C): │ │ │I am a tab bar │ │
+05 (C): │ ┌ tab-bar ─────────────────────────────────────────────────┐ │
+06 (C): │ │I am a tab bar │ │
+07 (C): │ │ ┌ Pane #2 ─────────────────────────────────────────────────┐ │
+08 (C): │ │ │ │ │
09 (C): │ │ │ ┌ status-bar ──────────────────────────────────────────────┐ │
10 (C): │ │ │ │I am a │ │
11 (C): │ │ │ │status bar │ │