summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAram Drevekenin <aram@poor.dev>2023-06-09 22:49:12 +0200
committerGitHub <noreply@github.com>2023-06-09 22:49:12 +0200
commit8485b1c2969e7f88feaf2f809b6b405fbe442ba4 (patch)
tree989148565b8883d9a04e35f795a3f50008c0e1b1
parent7f0b87852079f260cc9a834c2dc54eeb002d5879 (diff)
feat(plugins): extensive plugin api (#2516)
* feat(plugins): add our entire API * style(fmt): rustfmt * fix(detach): make it work again
-rw-r--r--default-plugins/fixture-plugin-for-tests/src/main.rs138
-rw-r--r--default-plugins/strider/src/search/mod.rs14
-rw-r--r--zellij-server/src/lib.rs8
-rw-r--r--zellij-server/src/plugins/mod.rs10
-rw-r--r--zellij-server/src/plugins/plugin_loader.rs72
-rw-r--r--zellij-server/src/plugins/plugin_map.rs11
-rw-r--r--zellij-server/src/plugins/unit/plugin_tests.rs3226
-rw-r--r--zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__can_subscribe_to_hd_events.snap4
-rw-r--r--zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__clear_screen_plugin_command.snap10
-rw-r--r--zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__close_focus_plugin_command.snap10
-rw-r--r--zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__close_focused_tab_plugin_command.snap10
-rw-r--r--zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__detach_plugin_command.snap12
-rw-r--r--zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__edit_scrollback_plugin_command.snap10
-rw-r--r--zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__focus_next_pane_plugin_command.snap10
-rw-r--r--zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__focus_or_create_tab_plugin_command.snap19
-rw-r--r--zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__focus_previous_pane_plugin_command.snap10
-rw-r--r--zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__go_to_next_tab_plugin_command.snap10
-rw-r--r--zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__go_to_previous_tab_plugin_command.snap10
-rw-r--r--zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__go_to_tab.snap13
-rw-r--r--zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__go_to_tab_name_plugin_command.snap19
-rw-r--r--zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__hide_self_plugin_command.snap13
-rw-r--r--zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__move_focus_or_tab_plugin_command.snap10
-rw-r--r--zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__move_focus_plugin_command.snap10
-rw-r--r--zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__move_pane_plugin_command.snap10
-rw-r--r--zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__move_pane_with_direction_plugin_command.snap10
-rw-r--r--zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__new_tab_plugin_command.snap19
-rw-r--r--zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__new_tabs_with_layout_plugin_command-2.snap60
-rw-r--r--zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__new_tabs_with_layout_plugin_command.snap60
-rw-r--r--zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__next_swap_layout_plugin_command.snap10
-rw-r--r--zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__open_command_pane_floating_plugin_command.snap30
-rw-r--r--zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__open_command_pane_plugin_command.snap30
-rw-r--r--zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__open_file_floating_plugin_command.snap25
-rw-r--r--zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__open_file_plugin_command.snap25
-rw-r--r--zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__open_file_with_line_floating_plugin_command.snap27
-rw-r--r--zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__open_file_with_line_plugin_command.snap27
-rw-r--r--zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__open_flie_plugin_command.snap25
-rw-r--r--zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__open_terminal_floating_plugin_command.snap29
-rw-r--r--zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__open_terminal_plugin_command.snap29
-rw-r--r--zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__page_scroll_down_plugin_command.snap10
-rw-r--r--zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__page_scroll_up_plugin_command.snap10
-rw-r--r--zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__previous_swap_layout_plugin_command.snap10
-rw-r--r--zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__quit_zellij_plugin_command.snap10
-rw-r--r--zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__resize_focused_pane_plugin_command.snap15
-rw-r--r--zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__resize_focused_pane_with_direction_plugin_command.snap17
-rw-r--r--zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__scroll_down_plugin_command.snap10
-rw-r--r--zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__scroll_to_bottom_plugin_command.snap10
-rw-r--r--zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__scroll_to_top_plugin_command.snap10
-rw-r--r--zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__scroll_up_plugin_command.snap10
-rw-r--r--zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__start_or_reload_plugin.snap13
-rw-r--r--zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__switch_to_mode_plugin_command.snap79
-rw-r--r--zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__switch_to_tab_plugin_command.snap13
-rw-r--r--zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__toggle_active_tab_sync_plugin_command.snap10
-rw-r--r--zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__toggle_focus_fullscreen_plugin_command.snap10
-rw-r--r--zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__toggle_pane_embed_or_eject_plugin_command.snap10
-rw-r--r--zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__toggle_pane_frames_plugin_command.snap8
-rw-r--r--zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__toggle_tab_plugin_command.snap10
-rw-r--r--zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__undo_rename_pane_plugin_command.snap10
-rw-r--r--zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__undo_rename_tab_plugin_command.snap10
-rw-r--r--zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__write_chars_plugin_command.snap17
-rw-r--r--zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__write_plugin_command.snap15
-rw-r--r--zellij-server/src/plugins/wasm_bridge.rs42
-rw-r--r--zellij-server/src/plugins/zellij_exports.rs650
-rw-r--r--zellij-server/src/route.rs302
-rw-r--r--zellij-server/src/screen.rs10
-rw-r--r--zellij-server/src/unit/screen_tests.rs352
-rw-r--r--zellij-tile/src/shim.rs224
-rw-r--r--zellij-utils/src/input/command.rs26
67 files changed, 5430 insertions, 568 deletions
diff --git a/default-plugins/fixture-plugin-for-tests/src/main.rs b/default-plugins/fixture-plugin-for-tests/src/main.rs
index 7e4139f55..2107137d1 100644
--- a/default-plugins/fixture-plugin-for-tests/src/main.rs
+++ b/default-plugins/fixture-plugin-for-tests/src/main.rs
@@ -38,10 +38,10 @@ impl ZellijPlugin for State {
fn load(&mut self) {
subscribe(&[
EventType::InputReceived,
+ EventType::Key,
EventType::SystemClipboardFailure,
EventType::CustomMessage,
EventType::FileSystemCreate,
- EventType::FileSystemRead,
EventType::FileSystemUpdate,
EventType::FileSystemDelete,
]);
@@ -49,6 +49,142 @@ impl ZellijPlugin for State {
fn update(&mut self, event: Event) -> bool {
match &event {
+ Event::Key(key) => match key {
+ Key::Char('a') => {
+ switch_to_input_mode(&InputMode::Tab);
+ },
+ Key::Char('b') => {
+ new_tabs_with_layout(
+ "layout {
+ tab {
+ pane
+ pane
+ }
+ tab split_direction=\"vertical\" {
+ pane
+ pane
+ }
+ }",
+ );
+ },
+ Key::Char('c') => new_tab(),
+ Key::Char('d') => go_to_next_tab(),
+ Key::Char('e') => go_to_previous_tab(),
+ Key::Char('f') => {
+ let resize = Resize::Increase;
+ resize_focused_pane(resize)
+ },
+ Key::Char('g') => {
+ let resize = Resize::Increase;
+ let direction = Direction::Left;
+ resize_focused_pane_with_direction(resize, direction);
+ },
+ Key::Char('h') => focus_next_pane(),
+ Key::Char('i') => focus_previous_pane(),
+ Key::Char('j') => {
+ let direction = Direction::Left;
+ move_focus(direction)
+ },
+ Key::Char('k') => {
+ let direction = Direction::Left;
+ move_focus_or_tab(direction)
+ },
+ Key::Char('l') => detach(),
+ Key::Char('m') => edit_scrollback(),
+ Key::Char('n') => {
+ let bytes = vec![102, 111, 111];
+ write(bytes)
+ },
+ Key::Char('o') => {
+ let chars = "foo";
+ write_chars(chars);
+ },
+ Key::Char('p') => toggle_tab(),
+ Key::Char('q') => move_pane(),
+ Key::Char('r') => {
+ let direction = Direction::Left;
+ move_pane_with_direction(direction)
+ },
+ Key::Char('s') => clear_screen(),
+ Key::Char('t') => scroll_up(),
+ Key::Char('u') => scroll_down(),
+ Key::Char('v') => scroll_to_top(),
+ Key::Char('w') => scroll_to_bottom(),