Skip to content

Commit

Permalink
fix(plugins): swap layouts and invoked_with (#2564)
Browse files Browse the repository at this point in the history
  • Loading branch information
imsnif authored Jun 19, 2023
1 parent 0adb105 commit 1280cc8
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 17 deletions.
1 change: 1 addition & 0 deletions zellij-server/src/panes/terminal_pane.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
12 changes: 8 additions & 4 deletions zellij-server/src/plugins/zellij_exports.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
@@ -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 ──────────────────────────────────────────────┐─────────────────────────────────────────────────┐──────────┐
Expand All @@ -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): │ │ │ │
Expand Down
Original file line number Diff line number Diff line change
@@ -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): └───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
---
source: zellij-server/src/tab/./unit/tab_integration_tests.rs
assertion_line: 5734
assertion_line: 6363
expression: snapshot
---
00 (C): ┌ Pane #1 ──────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
01 (C): │ │
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 │ │
Expand Down

0 comments on commit 1280cc8

Please sign in to comment.