aboutsummaryrefslogtreecommitdiffstats
path: root/zellij-utils/src/ipc/tests
diff options
context:
space:
mode:
authorAram Drevekenin <aram@poor.dev>2025-12-11 14:25:42 +0100
committerGitHub <noreply@github.com>2025-12-11 14:25:42 +0100
commit693fa082def5ef0fe030cd7fdc3b1df051b35dc6 (patch)
treeb3f651462bbc1cd2fa5b2d79207343413ef6b83c /zellij-utils/src/ipc/tests
parentfix(zellij-server): unblock building on 32bit targets (#4484) (diff)
downloadsl0ppij-693fa082def5ef0fe030cd7fdc3b1df051b35dc6.tar.gz
sl0ppij-693fa082def5ef0fe030cd7fdc3b1df051b35dc6.tar.xz
sl0ppij-693fa082def5ef0fe030cd7fdc3b1df051b35dc6.zip
Command Sequences, Blocking CLI Commands, New Plugin APIs (#4546)
* fix deadlocks * initial logging to plugin implementation * only log actions, include keys as Action::Write * send actions to plugins as a new Event::UserAction * add Action::Write metadata to plugin API * run_action plugin command and permission * block-until-exit/success/failure in the cli * fix tests * add NewBlockingPane to the plugin API * run actions in a different thread so as not to block plugin execution * add custom context to run_action flow * fixes for floating pane z_index sorting and unknown protobuf events not crashing plugins * always render the frame of pinned panes * macros module * add macros to config * KDL macro parsing * thread macros to the plugin thread * get/update/delete macros from plugins * add macros updated event * add ability to rename macros * fix deadlock * fix z_indices with pinned unselectable panes bug * allow plugins to opt-in to show_cursor * change show_cursor(bool) to show_cursor(Option<coordinates>) * test * upgrade strum to allow proper enum iteration and case insensitive fromstr implementation for Actions * better cwd tracking for exited command panes * add initial panes to NewTab Action (no-op for now) * add initial panes to cli newtab action * make initial panes work * add close_on_exit and start_suspended to the cli * properly convert newtab action (potentially breaking for plugins) * allow first pane in tab to block * make distinction between opening panes with the last active client and the current pane in the cli * improve some apis * fix fixed size closing pane bug * fix plugin cursor coordinates * fix issues with launch-or-focus-plugin having to do with in-place and suppressed panes * fix: set affected pane in replace pane * allow setting a pane in place when it is suppressed and being focused (tests failing) * fix tests * some fixes for unsuppression of panes * some fixes for completion_tx in new tab action * allow replace/suppressed rather than replace/close only * fixes for inserting suppressed panes without conflicts * pane focus history and explicit unsuppress plugin api * fix: prefer explicitly provided pane id in placement in actions that provide it * fix floating pane coordinate change and z_index * fix plugin cache dir to persist between sessions * fix some stack focusing issues when adding panes without a client id * make sure pinned panes are always above non-pinned floating panes * allow plugins to copy to clipboard * initial text styling additions implementations - buggy * fix dimming issues * remove extras, stay with just dim and unbold * unbold and dim as indices * allow ui components to render success/error colors * allow plugins to send sigint/sigkill to processes, as well as receive their pid * ui component fixes and send originating plugin context with run_action * originating plugin for new tab too * make plugn show pane command also expand stacked panes * add sequence plugin * remove macros * remove snapshots * add shortcut for sequence plugin * fix plugin tests * plugin tests for new apis * update snapshots for sequence shortcut * cleanups and formatting * Event::CwdChanged * moar cleanups * remove some warnings * remove mroe warnings * remove dead code * remove more dead code * fix minor bugs in sequence plugin * update sequence help and format codebase * fix conditional blocking cli commands * fix initial-command new-tab cli flag * add client_ids to CwdChanged Event * last fixes * add pr
Diffstat (limited to 'zellij-utils/src/ipc/tests')
-rw-r--r--zellij-utils/src/ipc/tests/roundtrip_tests.rs119
1 files changed, 115 insertions, 4 deletions
diff --git a/zellij-utils/src/ipc/tests/roundtrip_tests.rs b/zellij-utils/src/ipc/tests/roundtrip_tests.rs
index 2ec513da..61981f38 100644
--- a/zellij-utils/src/ipc/tests/roundtrip_tests.rs
+++ b/zellij-utils/src/ipc/tests/roundtrip_tests.rs
@@ -1,7 +1,8 @@
use super::test_framework::*;
use crate::data::{
- BareKey, ConnectToSession, Direction, FloatingPaneCoordinates, InputMode, KeyModifier,
- KeyWithModifier, LayoutInfo, OriginatingPlugin, PaneId, PluginTag, Resize, WebSharing,
+ BareKey, CommandOrPlugin, ConnectToSession, Direction, FloatingPaneCoordinates, InputMode,
+ KeyModifier, KeyWithModifier, LayoutInfo, OriginatingPlugin, PaneId, PluginTag, Resize,
+ WebSharing,
};
use crate::input::actions::{Action, SearchDirection, SearchOption};
use crate::input::cli_assets::CliAssets;
@@ -1019,6 +1020,7 @@ fn test_client_messages() {
in_place: false,
start_suppressed: false,
coordinates: None,
+ near_current_pane: false,
},
terminal_id: Some(1),
client_id: Some(100),
@@ -1041,6 +1043,7 @@ fn test_client_messages() {
in_place: false,
start_suppressed: false,
coordinates: None,
+ near_current_pane: false,
},
terminal_id: Some(1),
client_id: Some(100),
@@ -1063,6 +1066,7 @@ fn test_client_messages() {
in_place: false,
start_suppressed: false,
coordinates: None,
+ near_current_pane: false,
},
terminal_id: Some(1),
client_id: Some(100),
@@ -1085,6 +1089,7 @@ fn test_client_messages() {
in_place: true,
start_suppressed: true,
coordinates: FloatingPaneCoordinates::new(None, None, None, None, None),
+ near_current_pane: false,
},
terminal_id: Some(1),
client_id: Some(100),
@@ -1113,6 +1118,7 @@ fn test_client_messages() {
None,
None
),
+ near_current_pane: false,
},
terminal_id: Some(1),
client_id: Some(100),
@@ -1141,6 +1147,7 @@ fn test_client_messages() {
None,
None
),
+ near_current_pane: false,
},
terminal_id: Some(1),
client_id: Some(100),
@@ -1169,6 +1176,7 @@ fn test_client_messages() {
Some("20".to_owned()),
Some(true)
),
+ near_current_pane: false,
},
terminal_id: Some(1),
client_id: Some(100),
@@ -1191,6 +1199,7 @@ fn test_client_messages() {
in_place: true,
start_suppressed: true,
coordinates: FloatingPaneCoordinates::new(None, None, None, None, Some(false)),
+ near_current_pane: false,
},
terminal_id: Some(1),
client_id: Some(100),
@@ -1201,6 +1210,7 @@ fn test_client_messages() {
command: None,
pane_name: None,
coordinates: None,
+ near_current_pane: false,
},
terminal_id: Some(1),
client_id: Some(100),
@@ -1225,7 +1235,8 @@ fn test_client_messages() {
None,
None,
None
- )
+ ),
+ near_current_pane: false,
},
terminal_id: Some(1),
client_id: Some(100),
@@ -1254,7 +1265,8 @@ fn test_client_messages() {
None,
None,
None
- )
+ ),
+ near_current_pane: false,
},
terminal_id: Some(1),
client_id: Some(100),
@@ -1265,6 +1277,7 @@ fn test_client_messages() {
command: None,
direction: None,
pane_name: None,
+ near_current_pane: false,
},
terminal_id: Some(1),
client_id: Some(100),
@@ -1288,6 +1301,7 @@ fn test_client_messages() {
}),
direction: Some(Direction::Right),
pane_name: Some("my_pane_name".to_owned()),
+ near_current_pane: false,
},
terminal_id: Some(1),
client_id: Some(100),
@@ -1310,6 +1324,9 @@ fn test_client_messages() {
use_terminal_title: false,
}),
pane_name: Some("my_pane_name".to_owned()),
+ near_current_pane: false,
+ pane_id_to_replace: None,
+ close_replace_pane: false,
},
terminal_id: Some(1),
client_id: Some(100),
@@ -1319,6 +1336,9 @@ fn test_client_messages() {
action: Action::NewInPlacePane {
command: None,
pane_name: None,
+ near_current_pane: false,
+ pane_id_to_replace: None,
+ close_replace_pane: false,
},
terminal_id: Some(1),
client_id: Some(100),
@@ -1341,6 +1361,7 @@ fn test_client_messages() {
use_terminal_title: false,
}),
pane_name: Some("my_pane_name".to_owned()),
+ near_current_pane: false,
},
terminal_id: Some(1),
client_id: Some(100),
@@ -1350,6 +1371,7 @@ fn test_client_messages() {
action: Action::NewStackedPane {
command: None,
pane_name: None,
+ near_current_pane: false,
},
terminal_id: Some(1),
client_id: Some(100),
@@ -1396,6 +1418,8 @@ fn test_client_messages() {
tab_name: None,
should_change_focus_to_new_tab: false,
cwd: None,
+ initial_panes: None,
+ first_pane_unblock_condition: None,
},
terminal_id: Some(1),
client_id: Some(100),
@@ -1410,6 +1434,8 @@ fn test_client_messages() {
tab_name: None,
should_change_focus_to_new_tab: false,
cwd: None,
+ initial_panes: None,
+ first_pane_unblock_condition: None,
},
terminal_id: Some(1),
client_id: Some(100),
@@ -1427,6 +1453,8 @@ fn test_client_messages() {
tab_name: None,
should_change_focus_to_new_tab: false,
cwd: None,
+ initial_panes: None,
+ first_pane_unblock_condition: None,
},
terminal_id: Some(1),
client_id: Some(100),
@@ -1444,6 +1472,8 @@ fn test_client_messages() {
tab_name: None,
should_change_focus_to_new_tab: false,
cwd: None,
+ initial_panes: None,
+ first_pane_unblock_condition: None,
},
terminal_id: Some(1),
client_id: Some(100),
@@ -1462,6 +1492,8 @@ fn test_client_messages() {
tab_name: None,
should_change_focus_to_new_tab: false,
cwd: None,
+ initial_panes: None,
+ first_pane_unblock_condition: None,
},
terminal_id: Some(1),
client_id: Some(100),
@@ -1492,6 +1524,8 @@ fn test_client_messages() {
tab_name: None,
should_change_focus_to_new_tab: false,
cwd: None,
+ initial_panes: None,
+ first_pane_unblock_condition: None,
},
terminal_id: Some(1),
client_id: Some(100),
@@ -1509,6 +1543,8 @@ fn test_client_messages() {
tab_name: None,
should_change_focus_to_new_tab: false,
cwd: None,
+ initial_panes: None,
+ first_pane_unblock_condition: None,
},
terminal_id: Some(1),
client_id: Some(100),
@@ -1526,6 +1562,8 @@ fn test_client_messages() {
tab_name: None,
should_change_focus_to_new_tab: false,
cwd: None,
+ initial_panes: None,
+ first_pane_unblock_condition: None,
},
terminal_id: Some(1),
client_id: Some(100),
@@ -1545,6 +1583,8 @@ fn test_client_messages() {
tab_name: None,
should_change_focus_to_new_tab: false,
cwd: None,
+ initial_panes: None,
+ first_pane_unblock_condition: None,
},
terminal_id: Some(1),
client_id: Some(100),
@@ -1565,6 +1605,8 @@ fn test_client_messages() {
tab_name: None,
should_change_focus_to_new_tab: false,
cwd: None,
+ initial_panes: None,
+ first_pane_unblock_condition: None,
},
terminal_id: Some(1),
client_id: Some(100),
@@ -1585,6 +1627,8 @@ fn test_client_messages() {
tab_name: None,
should_change_focus_to_new_tab: false,
cwd: None,
+ initial_panes: None,
+ first_pane_unblock_condition: None,
},
terminal_id: Some(1),
client_id: Some(100),
@@ -1605,6 +1649,8 @@ fn test_client_messages() {
tab_name: None,
should_change_focus_to_new_tab: false,
cwd: None,
+ initial_panes: None,
+ first_pane_unblock_condition: None,
},
terminal_id: Some(1),
client_id: Some(100),
@@ -1625,6 +1671,8 @@ fn test_client_messages() {
tab_name: None,
should_change_focus_to_new_tab: false,
cwd: None,
+ initial_panes: None,
+ first_pane_unblock_condition: None,
},
terminal_id: Some(1),
client_id: Some(100),
@@ -1645,6 +1693,8 @@ fn test_client_messages() {
tab_name: None,
should_change_focus_to_new_tab: false,
cwd: None,
+ initial_panes: None,
+ first_pane_unblock_condition: None,
},
terminal_id: Some(1),
client_id: Some(100),
@@ -1665,6 +1715,8 @@ fn test_client_messages() {
tab_name: None,
should_change_focus_to_new_tab: false,
cwd: None,
+ initial_panes: None,
+ first_pane_unblock_condition: None,
},
terminal_id: Some(1),
client_id: Some(100),
@@ -1685,6 +1737,8 @@ fn test_client_messages() {
tab_name: None,
should_change_focus_to_new_tab: false,
cwd: None,
+ initial_panes: None,
+ first_pane_unblock_condition: None,
},
terminal_id: Some(1),
client_id: Some(100),
@@ -1705,6 +1759,8 @@ fn test_client_messages() {
tab_name: None,
should_change_focus_to_new_tab: false,
cwd: None,
+ initial_panes: None,
+ first_pane_unblock_condition: None,
},
terminal_id: Some(1),
client_id: Some(100),
@@ -1722,6 +1778,8 @@ fn test_client_messages() {
tab_name: None,
should_change_focus_to_new_tab: false,
cwd: None,
+ initial_panes: None,
+ first_pane_unblock_condition: None,
},
terminal_id: Some(1),
client_id: Some(100),
@@ -1745,6 +1803,8 @@ fn test_client_messages() {
tab_name: None,
should_change_focus_to_new_tab: false,
cwd: None,
+ initial_panes: None,
+ first_pane_unblock_condition: None,
},
terminal_id: Some(1),
client_id: Some(100),
@@ -1770,6 +1830,8 @@ fn test_client_messages() {
tab_name: None,
should_change_focus_to_new_tab: false,
cwd: None,
+ initial_panes: None,
+ first_pane_unblock_condition: None,
},
terminal_id: Some(1),
client_id: Some(100),
@@ -1799,6 +1861,8 @@ fn test_client_messages() {
tab_name: None,
should_change_focus_to_new_tab: false,
cwd: None,
+ initial_panes: None,
+ first_pane_unblock_condition: None,
},
terminal_id: Some(1),
client_id: Some(100),
@@ -1816,6 +1880,8 @@ fn test_client_messages() {
tab_name: None,
should_change_focus_to_new_tab: false,
cwd: None,
+ initial_panes: None,
+ first_pane_unblock_condition: None,
},
terminal_id: Some(1),
client_id: Some(100),
@@ -1837,6 +1903,8 @@ fn test_client_messages() {
tab_name: None,
should_change_focus_to_new_tab: false,
cwd: None,
+ initial_panes: None,
+ first_pane_unblock_condition: None,
},
terminal_id: Some(1),
client_id: Some(100),
@@ -1854,6 +1922,8 @@ fn test_client_messages() {
tab_name: None,
should_change_focus_to_new_tab: false,
cwd: None,
+ initial_panes: None,
+ first_pane_unblock_condition: None,
},
terminal_id: Some(1),
client_id: Some(100),
@@ -1891,6 +1961,8 @@ fn test_client_messages() {
tab_name: None,
should_change_focus_to_new_tab: false,
cwd: None,
+ initial_panes: None,
+ first_pane_unblock_condition: None,
},
terminal_id: Some(1),
client_id: Some(100),
@@ -1913,6 +1985,8 @@ fn test_client_messages() {
tab_name: None,
should_change_focus_to_new_tab: false,
cwd: None,
+ initial_panes: None,
+ first_pane_unblock_condition: None,
},
terminal_id: Some(1),
client_id: Some(100),
@@ -1927,6 +2001,8 @@ fn test_client_messages() {
tab_name: Some("tab_name".to_owned()),
should_change_focus_to_new_tab: false,
cwd: None,
+ initial_panes: None,
+ first_pane_unblock_condition: None,
},
terminal_id: Some(1),
client_id: Some(100),
@@ -1941,6 +2017,36 @@ fn test_client_messages() {
tab_name: None,
should_change_focus_to_new_tab: true,
cwd: Some(PathBuf::from("relative/path/to/cwd")),
+ initial_panes: None,
+ first_pane_unblock_condition: None,
+ },
+ terminal_id: Some(1),
+ client_id: Some(100),
+ is_cli_client: true,
+ });
+ test_client_roundtrip!(ClientToServerMsg::Action {
+ action: Action::NewTab {
+ tiled_layout: None,
+ floating_layouts: vec![],
+ swap_tiled_layouts: None,
+ swap_floating_layouts: None,
+ tab_name: None,
+ should_change_focus_to_new_tab: true,
+ cwd: None,
+ initial_panes: Some(vec![
+ CommandOrPlugin::Command(RunCommandAction {
+ command: PathBuf::from("/path/to/command"),
+ args: vec![],
+ cwd: None,
+ direction: None,
+ hold_on_close: false,
+ hold_on_start: false,
+ originating_plugin: None,
+ use_terminal_title: false,
+ }),
+ CommandOrPlugin::Plugin(RunPluginOrAlias::RunPlugin(RunPlugin::default())),
+ ]),
+ first_pane_unblock_condition: None,
},
terminal_id: Some(1),
client_id: Some(100),
@@ -2035,6 +2141,7 @@ fn test_client_messages() {
originating_plugin: None,
use_terminal_title: false,
},
+ near_current_pane: false,
},
terminal_id: Some(1),
client_id: Some(100),
@@ -2328,6 +2435,7 @@ fn test_client_messages() {
action: Action::FocusTerminalPaneWithId {
pane_id: 12,
should_float_if_hidden: false,
+ should_be_in_place_if_hidden: false,
},
terminal_id: Some(1),
client_id: Some(100),
@@ -2337,6 +2445,7 @@ fn test_client_messages() {
action: Action::FocusTerminalPaneWithId {
pane_id: 12,
should_float_if_hidden: true,
+ should_be_in_place_if_hidden: false,
},
terminal_id: Some(1),
client_id: Some(100),
@@ -2346,6 +2455,7 @@ fn test_client_messages() {
action: Action::FocusPluginPaneWithId {
pane_id: 12,
should_float_if_hidden: false,
+ should_be_in_place_if_hidden: true,
},
terminal_id: Some(1),
client_id: Some(100),
@@ -2355,6 +2465,7 @@ fn test_client_messages() {
action: Action::FocusPluginPaneWithId {
pane_id: 12,
should_float_if_hidden: true,
+ should_be_in_place_if_hidden: false,
},
terminal_id: Some(1),
client_id: Some(100),