aboutsummaryrefslogtreecommitdiffstats
path: root/zellij-server/src/plugins/unit/plugin_tests.rs
diff options
context:
space:
mode:
authorAram Drevekenin <aram@poor.dev>2024-08-16 14:00:01 +0200
committerGitHub <noreply@github.com>2024-08-16 14:00:01 +0200
commit056537d3eef06cddc60dc13b715a41766bb1fe9d (patch)
treeff7e107e992e4c98ac60ac88da7215cb0beb668a /zellij-server/src/plugins/unit/plugin_tests.rs
parentdocs(changelog): CommandPaneReRun plugin event (diff)
downloadsl0ppij-056537d3eef06cddc60dc13b715a41766bb1fe9d.tar.gz
sl0ppij-056537d3eef06cddc60dc13b715a41766bb1fe9d.tar.xz
sl0ppij-056537d3eef06cddc60dc13b715a41766bb1fe9d.zip
feat(ux): first run setup-wizard (#3556)
* separate saved/runtime structure, kind of working * serializing config * work * work * save config through the configuration screen * work * startup wizard * style(code): cleanups * fix(session): reload config from disk when switching sessions * style(fmt): rustfmt * fix(config): propagate cli config options to screen * style(fmt): rustfmt
Diffstat (limited to 'zellij-server/src/plugins/unit/plugin_tests.rs')
-rw-r--r--zellij-server/src/plugins/unit/plugin_tests.rs38
1 files changed, 36 insertions, 2 deletions
diff --git a/zellij-server/src/plugins/unit/plugin_tests.rs b/zellij-server/src/plugins/unit/plugin_tests.rs
index 1ce8ae0b..18df6159 100644
--- a/zellij-server/src/plugins/unit/plugin_tests.rs
+++ b/zellij-server/src/plugins/unit/plugin_tests.rs
@@ -11,6 +11,7 @@ use zellij_utils::data::{
PluginCapabilities,
};
use zellij_utils::errors::ErrorContext;
+use zellij_utils::input::keybinds::Keybinds;
use zellij_utils::input::layout::{
Layout, PluginAlias, PluginUserConfiguration, RunPlugin, RunPluginLocation, RunPluginOrAlias,
};
@@ -58,6 +59,35 @@ macro_rules! log_actions_in_thread {
};
}
+macro_rules! log_actions_in_thread_struct {
+ ( $arc_mutex_log:expr, $exit_event:path, $receiver:expr, $exit_after_count:expr ) => {
+ std::thread::Builder::new()
+ .name("logger thread".to_string())
+ .spawn({
+ let log = $arc_mutex_log.clone();
+ let mut exit_event_count = 0;
+ move || loop {
+ let (event, _err_ctx) = $receiver
+ .recv()
+ .expect("failed to receive event on channel");
+ match event {
+ $exit_event { .. } => {
+ exit_event_count += 1;
+ log.lock().unwrap().push(event);
+ if exit_event_count == $exit_after_count {
+ break;
+ }
+ },
+ _ => {
+ log.lock().unwrap().push(event);
+ },
+ }
+ }
+ })
+ .unwrap()
+ };
+}
+
macro_rules! grant_permissions_and_log_actions_in_thread {
( $arc_mutex_log:expr, $exit_event:path, $receiver:expr, $exit_after_count:expr, $permission_type:expr, $cache_path:expr, $plugin_thread_sender:expr, $client_id:expr ) => {
std::thread::Builder::new()
@@ -282,6 +312,7 @@ fn create_plugin_thread(
default_shell_action,
Box::new(plugin_aliases),
InputMode::Normal,
+ Keybinds::default(),
)
.expect("TEST")
})
@@ -362,6 +393,7 @@ fn create_plugin_thread_with_server_receiver(
default_shell_action,
Box::new(PluginAliases::default()),
InputMode::Normal,
+ Keybinds::default(),
)
.expect("TEST");
})
@@ -448,6 +480,7 @@ fn create_plugin_thread_with_pty_receiver(
default_shell_action,
Box::new(PluginAliases::default()),
InputMode::Normal,
+ Keybinds::default(),
)
.expect("TEST")
})
@@ -529,6 +562,7 @@ fn create_plugin_thread_with_background_jobs_receiver(
default_shell_action,
Box::new(PluginAliases::default()),
InputMode::Normal,
+ Keybinds::default(),
)
.expect("TEST")
})
@@ -6525,7 +6559,7 @@ pub fn reconfigure_plugin_command() {
client_id
);
let received_server_instruction = Arc::new(Mutex::new(vec![]));
- let server_thread = log_actions_in_thread!(
+ let server_thread = log_actions_in_thread_struct!(
received_server_instruction,
ServerInstruction::Reconfigure,
server_receiver,
@@ -6561,7 +6595,7 @@ pub fn reconfigure_plugin_command() {
.iter()
.rev()
.find_map(|i| {
- if let ServerInstruction::Reconfigure(..) = i {
+ if let ServerInstruction::Reconfigure { .. } = i {
Some(i.clone())
} else {
None