summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Cargo.lock13
-rw-r--r--Cargo.toml1
-rw-r--r--src/tests/e2e/cases.rs52
-rw-r--r--src/tests/e2e/snapshots/zellij__tests__e2e__cases__bracketed_paste.snap6
-rw-r--r--src/tests/e2e/snapshots/zellij__tests__e2e__cases__close_pane.snap6
-rw-r--r--src/tests/e2e/snapshots/zellij__tests__e2e__cases__detach_and_attach_session.snap6
-rw-r--r--src/tests/e2e/snapshots/zellij__tests__e2e__cases__focus_pane_with_mouse.snap6
-rw-r--r--src/tests/e2e/snapshots/zellij__tests__e2e__cases__lock_mode.snap2
-rw-r--r--src/tests/e2e/snapshots/zellij__tests__e2e__cases__mirrored_sessions-2.snap6
-rw-r--r--src/tests/e2e/snapshots/zellij__tests__e2e__cases__mirrored_sessions.snap6
-rw-r--r--src/tests/e2e/snapshots/zellij__tests__e2e__cases__multiple_users_in_different_panes_and_same_tab-2.snap6
-rw-r--r--src/tests/e2e/snapshots/zellij__tests__e2e__cases__multiple_users_in_different_panes_and_same_tab.snap6
-rw-r--r--src/tests/e2e/snapshots/zellij__tests__e2e__cases__multiple_users_in_different_tabs-2.snap6
-rw-r--r--src/tests/e2e/snapshots/zellij__tests__e2e__cases__multiple_users_in_different_tabs.snap6
-rw-r--r--src/tests/e2e/snapshots/zellij__tests__e2e__cases__multiple_users_in_same_pane_and_tab-2.snap4
-rw-r--r--src/tests/e2e/snapshots/zellij__tests__e2e__cases__multiple_users_in_same_pane_and_tab.snap4
-rw-r--r--src/tests/e2e/snapshots/zellij__tests__e2e__cases__open_new_tab.snap6
-rw-r--r--src/tests/e2e/snapshots/zellij__tests__e2e__cases__resize_pane.snap6
-rw-r--r--src/tests/e2e/snapshots/zellij__tests__e2e__cases__resize_terminal_window.snap6
-rw-r--r--src/tests/e2e/snapshots/zellij__tests__e2e__cases__scrolling_inside_a_pane.snap6
-rw-r--r--src/tests/e2e/snapshots/zellij__tests__e2e__cases__scrolling_inside_a_pane_with_mouse.snap6
-rw-r--r--src/tests/e2e/snapshots/zellij__tests__e2e__cases__send_command_through_the_cli.snap6
-rw-r--r--src/tests/e2e/snapshots/zellij__tests__e2e__cases__split_terminals_vertically.snap6
-rw-r--r--src/tests/e2e/snapshots/zellij__tests__e2e__cases__start_without_pane_frames.snap6
-rw-r--r--src/tests/e2e/snapshots/zellij__tests__e2e__cases__starts_with_one_terminal.snap6
-rw-r--r--src/tests/e2e/snapshots/zellij__tests__e2e__cases__status_bar_loads_custom_keybindings.snap6
-rw-r--r--src/tests/e2e/snapshots/zellij__tests__e2e__cases__tmux_mode.snap6
-rw-r--r--src/tests/e2e/snapshots/zellij__tests__e2e__cases__toggle_floating_panes.snap6
-rw-r--r--src/tests/e2e/snapshots/zellij__tests__e2e__cases__toggle_pane_fullscreen.snap6
-rw-r--r--src/tests/e2e/snapshots/zellij__tests__e2e__cases__typing_exit_closes_pane.snap6
-rw-r--r--src/tests/e2e/snapshots/zellij__tests__e2e__cases__undo_rename_pane.snap6
-rw-r--r--src/tests/e2e/snapshots/zellij__tests__e2e__cases__undo_rename_tab.snap6
-rw-r--r--zellij-server/src/plugins/mod.rs70
-rw-r--r--zellij-server/src/plugins/plugin_loader.rs244
-rw-r--r--zellij-server/src/plugins/plugin_map.rs94
-rw-r--r--zellij-server/src/plugins/wasm_bridge.rs622
-rw-r--r--zellij-server/src/plugins/zellij_exports.rs326
-rw-r--r--zellij-server/src/route.rs1
-rw-r--r--zellij-server/src/screen.rs9
39 files changed, 936 insertions, 662 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 1c580f328..01889eab8 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -30,9 +30,9 @@ dependencies = [
[[package]]
name = "aho-corasick"
-version = "0.7.18"
+version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f"
+checksum = "67fc08ce920c31afb70f013dcce1bfc3a3195de6a228474e45e1f145b36f8d04"
dependencies = [
"memchr",
]
@@ -2242,9 +2242,9 @@ dependencies = [
[[package]]
name = "regex"
-version = "1.5.6"
+version = "1.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d83f127d94bdbcda4c8cc2e50f6f84f4b611f69c902699ca385a39c3a75f9ff1"
+checksum = "af83e617f331cc6ae2da5443c602dfa5af81e517212d9d611a5b3ba1777b5370"
dependencies = [
"aho-corasick",
"memchr",
@@ -2253,9 +2253,9 @@ dependencies = [
[[package]]
name = "regex-syntax"
-version = "0.6.26"
+version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "49b3de9ec5dc0a3417da371aab17d729997c15010e7fd24ff707773a33bddb64"
+checksum = "a5996294f19bd3aae0453a862ad728f60e6600695733dd5df01da90c54363a3c"
[[package]]
name = "region"
@@ -3957,6 +3957,7 @@ dependencies = [
"miette 3.3.0",
"names",
"rand 0.8.5",
+ "regex",
"ssh2",
"suggest",
"thiserror",
diff --git a/Cargo.toml b/Cargo.toml
index f01e8f90d..484bacf2c 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -28,6 +28,7 @@ suggest = "0.4"
insta = { version = "1.6.0", features = ["backtrace"] }
ssh2 = "0.9.1"
rand = "0.8.0"
+regex = "1.8.1"
[workspace]
members = [
diff --git a/src/tests/e2e/cases.rs b/src/tests/e2e/cases.rs
index 418b08f98..e5b4493bf 100644
--- a/src/tests/e2e/cases.rs
+++ b/src/tests/e2e/cases.rs
@@ -4,6 +4,7 @@ use ::insta::assert_snapshot;
use zellij_utils::{pane_size::Size, position::Position};
use rand::Rng;
+use regex::Regex;
use std::fmt::Write;
use std::path::Path;
@@ -74,6 +75,26 @@ pub fn sgr_mouse_report(position: Position, button: u8) -> Vec<u8> {
.to_vec()
}
+// what we do here is adjust snapshots for various race conditions that should hopefully be
+// temporary until we can fix them - when adding stuff here, please add a detailed comment
+// explaining the race condition and what needs to be done to solve it
+fn account_for_races_in_snapshot(snapshot: String) -> String {
+ // these replacements need to be done because plugins set themselves as "unselectable" at runtime
+ // when they are loaded - since they are loaded asynchronously, sometimes the "BASE" indication
+ // (which should only happen if there's more than one selectable pane) is rendered and
+ // sometimes it isn't - this removes it entirely
+ //
+ // to fix this, we should set plugins as unselectable in the layout (before they are loaded),
+ // once that happens, we should be able to remove this hack (and adjust the snapshots for the
+ // trailing spaces that we had to get rid of here)
+ let base_replace = Regex::new(r" BASE \s*\n").unwrap();
+ let eol_arrow_replace = Regex::new(r"\s*\n").unwrap();
+ let snapshot = base_replace.replace_all(&snapshot, "\n").to_string();
+ let snapshot = eol_arrow_replace.replace_all(&snapshot, "\n").to_string();
+
+ snapshot
+}
+
// All the E2E tests are marked as "ignored" so that they can be run separately from the normal
// tests
@@ -105,6 +126,8 @@ pub fn starts_with_one_terminal() {
break last_snapshot;
}
};
+
+ let last_snapshot = account_for_races_in_snapshot(last_snapshot);
assert_snapshot!(last_snapshot);
}
@@ -152,6 +175,7 @@ pub fn split_terminals_vertically() {
break last_snapshot;
}
};
+ let last_snapshot = account_for_races_in_snapshot(last_snapshot);
assert_snapshot!(last_snapshot);
}
@@ -195,6 +219,7 @@ pub fn cannot_split_terminals_vertically_when_active_terminal_is_too_small() {
break last_snapshot;
}
};
+ let last_snapshot = account_for_races_in_snapshot(last_snapshot);
assert_snapshot!(last_snapshot);
}
@@ -272,6 +297,7 @@ pub fn scrolling_inside_a_pane() {
break last_snapshot;
}
};
+ let last_snapshot = account_for_races_in_snapshot(last_snapshot);
assert_snapshot!(last_snapshot);
}
@@ -332,6 +358,7 @@ pub fn toggle_pane_fullscreen() {
break last_snapshot;
}
};
+ let last_snapshot = account_for_races_in_snapshot(last_snapshot);
assert_snapshot!(last_snapshot);
}
@@ -396,6 +423,7 @@ pub fn open_new_tab() {
break last_snapshot;
}
};
+ let last_snapshot = account_for_races_in_snapshot(last_snapshot);
assert_snapshot!(last_snapshot);
}
@@ -536,6 +564,7 @@ pub fn close_pane() {
break last_snapshot;
}
};
+ let last_snapshot = account_for_races_in_snapshot(last_snapshot);
assert_snapshot!(last_snapshot);
}
@@ -680,6 +709,7 @@ pub fn typing_exit_closes_pane() {
break last_snapshot;
}
};
+ let last_snapshot = account_for_races_in_snapshot(last_snapshot);
assert_snapshot!(last_snapshot);
}
@@ -742,6 +772,7 @@ pub fn resize_pane() {
break last_snapshot;
}
};
+ let last_snapshot = account_for_races_in_snapshot(last_snapshot);
assert_snapshot!(last_snapshot);
}
@@ -801,6 +832,7 @@ pub fn lock_mode() {
break last_snapshot;
}
};
+ // let last_snapshot = account_for_races_in_snapshot(last_snapshot);
assert_snapshot!(last_snapshot);
}
@@ -864,6 +896,7 @@ pub fn resize_terminal_window() {
break last_snapshot;
}
};
+ let last_snapshot = account_for_races_in_snapshot(last_snapshot);
assert_snapshot!(last_snapshot);
}
@@ -949,6 +982,7 @@ pub fn detach_and_attach_session() {
break last_snapshot;
}
};
+ let last_snapshot = account_for_races_in_snapshot(last_snapshot);
assert_snapshot!(last_snapshot);
}
@@ -984,6 +1018,7 @@ pub fn status_bar_loads_custom_keybindings() {
break last_snapshot;
}
};
+ let last_snapshot = account_for_races_in_snapshot(last_snapshot);
assert_snapshot!(last_snapshot);
}
@@ -1043,6 +1078,7 @@ fn focus_pane_with_mouse() {
break last_snapshot;
}
};
+ let last_snapshot = account_for_races_in_snapshot(last_snapshot);
assert_snapshot!(last_snapshot);
}
@@ -1118,6 +1154,7 @@ pub fn scrolling_inside_a_pane_with_mouse() {
break last_snapshot;
}
};
+ let last_snapshot = account_for_races_in_snapshot(last_snapshot);
assert_snapshot!(last_snapshot);
}
@@ -1164,6 +1201,7 @@ pub fn start_without_pane_frames() {
break last_snapshot;
}
};
+ let last_snapshot = account_for_races_in_snapshot(last_snapshot);
assert_snapshot!(last_snapshot);
}
@@ -1308,6 +1346,8 @@ pub fn mirrored_sessions() {
break (first_runner_snapshot, second_runner_snapshot);
}
};
+ let first_runner_snapshot = account_for_races_in_snapshot(first_runner_snapshot);
+ let second_runner_snapshot = account_for_races_in_snapshot(second_runner_snapshot);
assert_snapshot!(first_runner_snapshot);
assert_snapshot!(second_runner_snapshot);
}
@@ -1396,6 +1436,8 @@ pub fn multiple_users_in_same_pane_and_tab() {
break (first_runner_snapshot, second_runner_snapshot);
}
};
+ let first_runner_snapshot = account_for_races_in_snapshot(first_runner_snapshot);
+ let second_runner_snapshot = account_for_races_in_snapshot(second_runner_snapshot);
assert_snapshot!(first_runner_snapshot);
assert_snapshot!(second_runner_snapshot);
}
@@ -1486,6 +1528,8 @@ pub fn multiple_users_in_different_panes_and_same_tab() {
break (first_runner_snapshot, second_runner_snapshot);
}
};
+ let first_runner_snapshot = account_for_races_in_snapshot(first_runner_snapshot);
+ let second_runner_snapshot = account_for_races_in_snapshot(second_runner_snapshot);
assert_snapshot!(first_runner_snapshot);
assert_snapshot!(second_runner_snapshot);
}
@@ -1581,6 +1625,8 @@ pub fn multiple_users_in_different_tabs() {
break (first_runner_snapshot, second_runner_snapshot);
}
};
+ let first_runner_snapshot = account_for_races_in_snapshot(first_runner_snapshot);
+ let second_runner_snapshot = account_for_races_in_snapshot(second_runner_snapshot);
assert_snapshot!(first_runner_snapshot);
assert_snapshot!(second_runner_snapshot);
}
@@ -1637,6 +1683,7 @@ pub fn bracketed_paste() {
break last_snapshot;
}
};
+ let last_snapshot = account_for_races_in_snapshot(last_snapshot);
assert_snapshot!(last_snapshot);
}
@@ -1684,6 +1731,7 @@ pub fn toggle_floating_panes() {
break last_snapshot;
}
};
+ let last_snapshot = account_for_races_in_snapshot(last_snapshot);
assert_snapshot!(last_snapshot);
}
@@ -1731,6 +1779,7 @@ pub fn tmux_mode() {
break last_snapshot;
}
};
+ let last_snapshot = account_for_races_in_snapshot(last_snapshot);
assert_snapshot!(last_snapshot);
}
@@ -1829,6 +1878,7 @@ pub fn undo_rename_tab() {
break last_snapshot;
}
};
+ let last_snapshot = account_for_races_in_snapshot(last_snapshot);
assert_snapshot!(last_snapshot);
}
@@ -1878,6 +1928,7 @@ pub fn undo_rename_pane() {
break last_snapshot;
}
};
+ let last_snapshot = account_for_races_in_snapshot(last_snapshot);
assert_snapshot!(last_snapshot);
}
@@ -1987,5 +2038,6 @@ pub fn send_command_through_the_cli() {
break last_snapshot;
}
};
+ let last_snapshot = account_for_races_in_snapshot(last_snapshot);
assert_snapshot!(last_snapshot);
}
diff --git a/src/tests/e2e/snapshots/zellij__tests__e2e__cases__bracketed_paste.snap b/src/tests/e2e/snapshots/zellij__tests__e2e__cases__bracketed_paste.snap
index 45d5bc9fd..55cb8d8af 100644
--- a/src/tests/e2e/snapshots/zellij__tests__e2e__cases__bracketed_paste.snap
+++ b/src/tests/e2e/snapshots/zellij__tests__e2e__cases__bracketed_paste.snap
@@ -1,9 +1,9 @@
---
source: src/tests/e2e/cases.rs
-assertion_line: 1640
+assertion_line: 1676
expression: last_snapshot
---
- Zellij (e2e-test)  Tab #1 
+ Zellij (e2e-test)  Tab #1 
┌ Pane #1 ─────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│$ ^Tnabc█ │
│ │
@@ -25,5 +25,5 @@ expression: last_snapshot
│ │
│ │
└──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
- Ctrl + <g> LOCK  <p> PANE  <t> TAB  <n> RESIZE  <h> MOVE  <s> SEARCH  <o> SESSION  <q> QUIT 
+ Ctrl + <g> LOCK  <p> PANE  <t> TAB  <n> RESIZE  <h> MOVE  <s> SEARCH  <o> SESSION  <q> QUIT 
Tip: Alt + <n> => new pane. Alt + <←↓↑→> or Alt + <hjkl> => navigate. Alt + <+|-> => resize pane.
diff --git a/src/tests/e2e/snapshots/zellij__tests__e2e__cases__close_pane.snap b/src/tests/e2e/snapshots/zellij__tests__e2e__cases__close_pane.snap
index ac55a9d4a..d7d6423ff 100644
--- a/src/tests/e2e/snapshots/zellij__tests__e2e__cases__close_pane.snap
+++ b/src/tests/e2e/snapshots/zellij__tests__e2e__cases__close_pane.snap
@@ -1,9 +1,9 @@
---
source: src/tests/e2e/cases.rs
-assertion_line: 538
+assertion_line: 557
expression: last_snapshot
---
- Zellij (e2e-test)  Tab #1 
+ Zellij (e2e-test)  Tab #1 
┌ Pane #1 ─────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│$ █ │
│ │
@@ -25,5 +25,5 @@ expression: last_snapshot
│ │
│ │
└──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
- Ctrl + <g> LOCK  <p> PANE  <t> TAB  <n> RESIZE  <h> MOVE  <s> SEARCH  <o> SESSION  <q> QUIT 
+ Ctrl + <g> LOCK  <p> PANE  <t> TAB  <n> RESIZE  <h> MOVE  <s> SEARCH  <o> SESSION  <q> QUIT 
Tip: Alt + <n> => new pane. Alt + <←↓↑→> or Alt + <hjkl> => navigate. Alt + <+|-> => resize pane.
diff --git a/src/tests/e2e/snapshots/zellij__tests__e2e__cases__detach_and_attach_session.snap b/src/tests/e2e/snapshots/zellij__tests__e2e__cases__detach_and_attach_session.snap
index c42ad188b..7140fc40c 100644
--- a/src/tests/e2e/snapshots/zellij__tests__e2e__cases__detach_and_attach_session.snap
+++ b/src/tests/e2e/snapshots/zellij__tests__e2e__cases__detach_and_attach_session.snap
@@ -1,9 +1,9 @@
---
source: src/tests/e2e/cases.rs
-assertion_line: 952
+assertion_line: 975
expression: last_snapshot
---
- Zellij (e2e-test)  Tab #1 
+ Zellij (e2e-test)  Tab #1 
┌ Pane #1 ─────────────────────────────────────────────────┐┌ Pane #2 ─────────────────────────────────────────────────┐
│$ ││$ I am some text█ │
│ ││ │
@@ -25,5 +25,5 @@ expression: last_snapshot
│ ││ │
│ ││ │
└──────────────────────────────────────────────────────────┘└───