id stringlengths 20 30 | source stringclasses 1
value | chunk_index int64 0 520k | token_count int32 154 512 | content stringlengths 185 57.5k |
|---|---|---|---|---|
rust_dataset_chunk_514000 | rust_dataset.txt | 514,000 | 512 | expect("Load should complete");
}
// Execute jobs for each
for i in 1..=3 {
let tx_clone = tx.clone();
executor.execute_for_plugin(i, make_signaling_job(tx_clone));
}
for _ in 0..3 {
rx.recv_timeout(Duration::from_secs(5))
.exp... |
rust_dataset_chunk_514001 | rust_dataset.txt | 514,001 | 512 | };
use std::collections::{HashMap, HashSet};
use zellij_utils::data::{PipeMessage, PipeSource};
use zellij_utils::plugin_api::pipe_message::ProtobufPipeMessage;
use prost::Message;
use zellij_utils::errors::prelude::*;
use crate::{thread_bus::ThreadSenders, ClientId};
#[derive(Debug, Clone, PartialEq)]
pub enum Pipe... |
rust_dataset_chunk_514002 | rust_dataset.txt | 514,002 | 512 | : &PluginId,
client_id: &ClientId,
) -> Vec<PipeRelease> {
if self.finished.contains(cli_pipe_name) {
return vec![];
}
let is_final = matches!(
pipe_state_change,
PipeStateChange::Unblock | PipeStateChange::Crashed
);
let has_exit_c... |
rust_dataset_chunk_514003 | rust_dataset.txt | 514,003 | 512 | be unblocked
fn legacy_update_pipe_state_change(
&mut self,
cli_pipe_name: &str,
pipe_state_change: PipeStateChange,
plugin_id: &PluginId,
client_id: &ClientId,
) -> Vec<String> {
let mut pipe_names_to_unblock = vec![];
match self.pipes.get_mut(cli_pipe_n... |
rust_dataset_chunk_514004 | rust_dataset.txt | 514,004 | 512 | : Option<PluginId>,
currently_being_processed_by: HashSet<(PluginId, ClientId)>,
}
impl PendingPipeInfo {
pub fn new(plugin_id: &PluginId, client_id: &ClientId) -> Self {
let mut currently_being_processed_by = HashSet::new();
currently_being_processed_by.insert((*plugin_id, *client_id));
... |
rust_dataset_chunk_514005 | rust_dataset.txt | 514,005 | 512 | plugin_id, client_id)| {
plugin_id != plugin_id_to_unload || client_id != client_id_to_unload
});
self.currently_being_processed_by.is_empty() && !self.is_explicitly_blocked
}
}
pub fn apply_pipe_message_to_plugin(
plugin_id: PluginId,
client_id: ClientId,
running_pl... |
rust_dataset_chunk_514006 | rust_dataset.txt | 514,006 | 512 | _decodable_by_0_45(
&protobuf_pipe_message,
)
{
return Ok(());
}
match instance.get_typed_func::<(), i32>(&mut running_plugin.store, "pipe") {
Ok(pipe) => {
wasi_write_object(
running_plugin.store.data(),
&protobuf_pipe_message.... |
rust_dataset_chunk_514007 | rust_dataset.txt | 514,007 | 512 | will be super crowded
let pipes_to_block_or_unblock =
pipes_to_block_or_unblock(running_plugin, Some(&pipe_message.source));
let plugin_render_asset = PluginRenderAsset::new(
plugin_id,
client_id,
vec![], // nothing to render
... |
rust_dataset_chunk_514008 | rust_dataset.txt | 514,008 | 512 | , &PLUGIN, &CLIENT);
assert_eq!(
releases,
vec![PipeRelease {
pipe_id: "p".to_owned(),
exit_code: None
}]
);
assert!(!pipes.is_finished("p"));
}
#[test]
fn the_stored_exit_code_is_sent_when_the_plugin_unblocks_the_p... |
rust_dataset_chunk_514009 | rust_dataset.txt | 514,009 | 512 | exit_code: Some(1)
}]
);
}
#[test]
fn the_stored_exit_code_is_sent_when_the_plugin_closes_between_messages() {
let mut pipes = PendingPipes::default();
pipes.set_exit_code("p", 1, PLUGIN);
let releases = pipes.unload_plugin(&PLUGIN);
asser... |
rust_dataset_chunk_514010 | rust_dataset.txt | 514,010 | 512 | crate::plugins::plugin_worker::{plugin_worker, RunningWorker};
use crate::plugins::wasm_bridge::{LoadingContext, PluginCache};
use crate::plugins::zellij_exports::{wasi_write_object, zellij_exports};
use crate::plugins::PluginId;
use prost::Message;
use std::{
collections::{HashMap, HashSet, VecDeque},
fs,
... |
rust_dataset_chunk_514011 | rust_dataset.txt | 514,011 | 512 | fs::create_dir_all(&plugin_own_cache_dir) {
log::error!("Failed to create plugin cache dir: {}", e);
}
if let Err(e) = fs::create_dir_all(ZELLIJ_TMP_DIR.as_path()) {
log::error!("Failed to create plugin tmp dir: {}", e);
}
}
pub struct PluginLoader<'a> {
skip_cache: bool,
plugin_id... |
rust_dataset_chunk_514012 | rust_dataset.txt | 514,012 | 512 | _vars: loading_context.session_env_vars,
default_shell: loading_context.default_shell,
layout_dir: loading_context.layout_dir,
default_mode: loading_context.default_mode,
keybinds: loading_context.keybinds,
plugin_dir: loading_context.plugin_dir,
s... |
rust_dataset_chunk_514013 | rust_dataset.txt | 514,013 | 512 | )
}
fn load_module_from_memory(&mut self) -> Result<Module> {
let module = self
.plugin_cache
.lock()
.unwrap()
.remove(&self.plugin_config.path) // TODO: do we still bring it back later?
// maybe we can forgo this dance?
.ok_or(any... |
rust_dataset_chunk_514014 | rust_dataset.txt | 514,014 | 512 | self.plugin_id,
self.client_id,
plugin.clone(),
subscriptions,
workers,
);
}
start_function
.call(&mut plugin.lock().unwrap().store, ())
.with_context(err_context)?;
let protobuf_plugin_configu... |
rust_dataset_chunk_514015 | rust_dataset.txt | 514,015 | 512 | _to_block: Arc::new(Mutex::new(HashSet::new())),
layout_dir: self.layout_dir.clone(),
default_mode: self.default_mode.clone(),
subscriptions: Arc::new(Mutex::new(HashSet::new())),
keybinds: self.keybinds.clone(),
intercepting_key_presses: false,
pe... |
rust_dataset_chunk_514016 | rust_dataset.txt | 514,016 | 512 | ",
plugin_id
)
};
let module = self
.plugin_cache
.lock()
.unwrap()
.get(&self.plugin_config.path)
.with_context(err_context)?
.clone();
let (store, instance) = self.create_plugin_instance_env(&mo... |
rust_dataset_chunk_514017 | rust_dataset.txt | 514,017 | 512 | _env);
// Apply optimized resource limits for memory efficiency
store.limiter(|plugin_env| &mut plugin_env.store_limits);
let mut linker = Linker::new(&self.engine);
wasmi_wasi::add_to_linker(&mut linker, |plugin_env: &mut PluginEnv| {
&mut plugin_env.wasi_ctx
})?;
... |
rust_dataset_chunk_514018 | rust_dataset.txt | 514,018 | 512 | _path)?;
},
Err(e) => {
log::warn!("Failed to mount directory {:?}: {}", host_path, e);
},
}
}
let ctx = builder.build();
// Set up custom stdin/stdout/stderr
ctx.set_stdin(Box::new(ReadPipe::new(VecDequeIn... |
rust_dataset_chunk_514019 | rust_dataset.txt | 514,019 | 512 | when adding/removing from the map - everything is halted, that's life
// but when cloning the internal RunningPlugin and Subscriptions atomics, we can call methods on
// them without blocking other instances
pub type PluginKey = (PluginId, ClientId);
pub type PluginAssets = (
Arc<Mutex<RunningPlugin>>,
Arc<Mut... |
rust_dataset_chunk_514020 | rust_dataset.txt | 514,020 | 512 | _call) => {
self.shared_blocking_calls
.insert(instance_id, in_blocking_call);
},
None => {
self.shared_blocking_calls.remove(&instance_id);
},
}
}
pub fn remove_shared(&mut self, instance_id: PluginId) -> Option<Plu... |
rust_dataset_chunk_514021 | rust_dataset.txt | 514,021 | 512 | _plugins(&mut self) -> Vec<(PluginId, ClientId, Arc<Mutex<RunningPlugin>>)> {
self.plugin_assets
.iter()
.map(|((plugin_id, client_id), (running_plugin, _, _))| {
(*plugin_id, *client_id, running_plugin.clone())
})
.collect()
}
pub fn runni... |
rust_dataset_chunk_514022 | rust_dataset.txt | 514,022 | 512 | (|((p_id, c_id), _)| p_id == &plugin_id && c_id == &client_id)
.and_then(|(_, (_running_plugin, _subscriptions, workers))| {
if let Some(worker) = workers.get(&format!("{}_worker", worker_name)) {
Some(worker.clone())
} else {
None
... |
rust_dataset_chunk_514023 | rust_dataset.txt | 514,023 | 512 | vec![(*plugin_id, *client_id)],
);
cloned_plugin_assets.insert(running_plugin_location.clone(), location_map);
},
}
}
cloned_plugin_assets
}
pub fn contains(&self, plugin_id: PluginId, client_id: ClientId... |
rust_dataset_chunk_514024 | rust_dataset.txt | 514,024 | 512 | asiCtx,
pub client_id: ClientId,
#[allow(dead_code)]
pub plugin_own_data_dir: PathBuf,
pub plugin_own_cache_dir: PathBuf,
pub path_to_default_shell: PathBuf,
pub default_shell: Option<TerminalAction>,
pub layout_dir: Option<PathBuf>,
pub plugin_cwd: PathBuf,
pub session_env_vars: std... |
rust_dataset_chunk_514025 | rust_dataset.txt | 514,025 | 512 | ClientId, slot_id: PluginId) -> bool {
match self.visible_slots.get(&client_id) {
Some(visible) => visible.contains(&slot_id),
None => true,
}
}
pub fn renderable_slot(&self, slot_id: PluginId) -> Option<(usize, usize)> {
self.slots.get(&slot_id).and_then(|slot| ... |
rust_dataset_chunk_514026 | rust_dataset.txt | 514,026 | 512 | mut self) -> std::io::Result<()> {
let mut inner = self.0.lock().unwrap();
inner.flush()
}
}
impl PluginEnv {
// Get the name (path) of the containing plugin
pub fn name(&self) -> String {
format!(
"{} (ID {})",
self.plugin.path.display().to_string(),
... |
rust_dataset_chunk_514027 | rust_dataset.txt | 514,027 | 512 | _id + 1;
self.next_event_ids.insert(atomic_event, next_event_id);
current_event_id
} else {
let current_event_id = 0;
let next_event_id = 1;
self.last_applied_event_ids.remove(&atomic_event);
self.next_event_ids.insert(atomic_event, next_ev... |
rust_dataset_chunk_514028 | rust_dataset.txt | 514,028 | 512 | x60, 0, 0]);
bytes.extend_from_slice(&[3, 2, 1, 0]);
bytes.push(7);
bytes.push(exports.len() as u8);
bytes.extend(exports);
bytes.extend_from_slice(&[10, 4, 1, 2, 0, 0x0b]);
bytes
}
fn lacks_marker(location: RunPluginLocation, exports: &[&str]) -> bool {
... |
rust_dataset_chunk_514029 | rust_dataset.txt | 514,029 | 512 | Env>, instance: Instance, name: &str) -> Self {
RunningWorker {
store,
instance,
name: name.into(),
}
}
pub fn send_message(&mut self, message: String, payload: String) -> Result<()> {
let err_context = || format!("Failed to send message to worker");
... |
rust_dataset_chunk_514030 | rust_dataset.txt | 514,030 | 512 | = u32::MAX - 1;
impl PromptCaller {
pub fn close_dialogue(client_id: ClientId, request_id: u64) -> Self {
PromptCaller {
plugin_id: CLOSE_DIALOGUE_CALLER_ID,
client_id,
request_id,
}
}
pub fn is_close_dialogue(&self) -> bool {
self.plugin_id == C... |
rust_dataset_chunk_514031 | rust_dataset.txt | 514,031 | 512 | vec![PromptAction::Close(prompt_plugin_id)]
},
}
}
pub fn fail(&mut self, caller: PromptCaller, error: String) -> Vec<PromptAction> {
match self.pending.remove(&caller) {
Some(_) => vec![PromptAction::Deliver(caller, PromptResult::Error(error))],
... |
rust_dataset_chunk_514032 | rust_dataset.txt | 514,032 | 512 | {
matches!(pending.state, PromptState::Open(plugin_id) if plugin_id == prompt_plugin_id)
})
.map(|(caller, _)| *caller)
.collect();
let mut actions = vec![];
for caller in callers {
if let Some(pending) = self.pending.remove(&caller) {
... |
rust_dataset_chunk_514033 | rust_dataset.txt | 514,033 | 512 | _id, caller.client_id);
assert_eq!(
message.args.get("_caller_pane_title").map(|s| s.as_str()),
Some("fixture")
);
},
other => panic!("unexpected {:?}", other),
}
}
#[test]
fn the_answer_reaches_only_the... |
rust_dataset_chunk_514034 | rust_dataset.txt | 514,034 | 512 | {
let mut requests = PromptRequests::default();
let asker = caller(1, 1, 7);
requests.start(asker, message(asker), false);
assert!(requests.plugin_unloaded(1).is_empty());
assert_eq!(
requests.attach(asker, 10, 1, BTreeMap::new()),
vec![PromptAction::Clos... |
rust_dataset_chunk_514035 | rust_dataset.txt | 514,035 | 512 | );
}
#[test]
fn a_withdrawn_prompt_closes_without_an_answer() {
let mut requests = PromptRequests::default();
let asker = PromptCaller::close_dialogue(1, 3);
let other = caller(1, 1, 3);
opened(&mut requests, asker, 10);
opened(&mut requests, other, 11);
ass... |
rust_dataset_chunk_514036 | rust_dataset.txt | 514,036 | 512 | so a registration from an unloaded plugin that was still on
// its way can be refused
unloaded: HashSet<PluginId>,
}
#[derive(Debug, Clone, PartialEq, Eq)]
struct RegisteredEntry {
plugin_id: PluginId,
plugin_identity: PluginIdentity,
title: String,
}
impl SettingsEntries {
/// Adds or retitl... |
rust_dataset_chunk_514037 | rust_dataset.txt | 514,037 | 512 | )> = vec![];
for entry in &self.entries {
match listed.iter_mut().find(|(plugin_identity, listed_entry)| {
**plugin_identity == entry.plugin_identity && listed_entry.title == entry.title
}) {
Some((_, listed_entry)) => {
listed_entry.pl... |
rust_dataset_chunk_514038 | rust_dataset.txt | 514,038 | 512 | _that_plugins_entry() {
let mut entries = SettingsEntries::default();
entries.register(1, status(), "Status");
entries.register(2, clock(), "Clock");
assert!(entries.unregister(1));
assert!(!entries.unregister(1));
assert!(!entries.unregister(9));
assert_eq!(liste... |
rust_dataset_chunk_514039 | rust_dataset.txt | 514,039 | 512 | pped_of_control_characters_trimmed_and_capped() {
let mut entries = SettingsEntries::default();
entries.register(1, status(), " \u{1b}[31mStatus\nbar\u{202e} ");
assert_eq!(listed(&entries), vec![(1, "[31mStatusbar".to_owned())]);
entries.register(1, status(), &"x".repeat(200));
... |
rust_dataset_chunk_514040 | rust_dataset.txt | 514,040 | 512 | ::Message;
use std::collections::{BTreeMap, HashMap, HashSet};
use std::path::PathBuf;
use std::sync::{Arc, Mutex};
use wasmi::Engine;
use zellij_utils::data::KeybindsVec;
use zellij_utils::data::{
Event, EventContext, EventType, PermissionStatus, PipeMessage, PipeSource, RenderResponse, Slot,
};
use zellij_utils::... |
rust_dataset_chunk_514041 | rust_dataset.txt | 514,041 | 512 | {
let mut cursor = position;
let Some(count) = read_leb_u32(bytes, &mut cursor) else {
return false;
};
for _ in 0..count {
let Some(name_len) = read_leb_u32(bytes, &mut cursor) else {
return false;
};
... |
rust_dataset_chunk_514042 | rust_dataset.txt | 514,042 | 512 | to call {} on shared plugin", name))
}
fn call_returning_i32(running_plugin: &mut RunningPlugin, name: &str) -> Result<i32> {
let instance = running_plugin.instance.clone();
instance
.get_typed_func::<(), i32>(&mut running_plugin.store, name)
.and_then(|function| function.call(&mut running_plu... |
rust_dataset_chunk_514043 | rust_dataset.txt | 514,043 | 512 | ());
}
let protobuf_slot: ProtobufSlot = Slot {
id: slot_id,
kind: slot.kind,
configuration: slot.configuration,
}
.into();
wasi_write_object(running_plugin.store.data(), &protobuf_slot.encode_to_vec())?;
set_call_context(running_plugin, Some(slot_id), None, true);
le... |
rust_dataset_chunk_514044 | rust_dataset.txt | 514,044 | 512 | _context.encode_to_vec(),
)?;
wasi_write_object(running_plugin.store.data(), &protobuf_event.encode_to_vec())?;
set_call_context(running_plugin, context.slot_id, context.client_id, false);
let result = call_returning_i32(running_plugin, "shared_update");
clear_call_context(running_plugin);
Ok(re... |
rust_dataset_chunk_514045 | rust_dataset.txt | 514,045 | 512 | .map_err(|e| anyhow!(e));
clear_call_context(running_plugin);
result.with_context(|| format!("failed to render shared plugin slot {}", slot_id))?;
let rendered = wasi_read_string(running_plugin.store.data())?;
assets.push(PluginRenderAsset::new(
*slot_id,
*client... |
rust_dataset_chunk_514046 | rust_dataset.txt | 514,046 | 512 | pipes_to_block_or_unblock(running_plugin, current_pipe);
if !changes.is_empty() {
let asset =
PluginRenderAsset::new(instance_id, SHARED_PIPE_CLIENT, vec![]).with_pipes(changes);
let _ = senders.send_to_plugin(PluginInstruction::UnblockCliPipes(vec![asset]));
}
}
fn release_pipe(se... |
rust_dataset_chunk_514047 | rust_dataset.txt | 514,047 | 512 | continue;
}
if is_deduplicated_event(event_type) {
if let Some(shared) = running_plugin.store.data_mut().shared.as_mut() {
let key = (event_type, context.client_id);
let already_delivered = shared
.last_events
... |
rust_dataset_chunk_514048 | rust_dataset.txt | 514,048 | 512 | ;
};
let mut running_plugin = running_plugin.lock().unwrap();
let mut render = RenderResponse::Nothing;
let mut messages = messages.into_iter();
while let Some((pipe_message, context)) = messages.next() {
match call_pipe(&mut running_plugin, &pipe_message, context) {
Ok(requested... |
rust_dataset_chunk_514049 | rust_dataset.txt | 514,049 | 512 | _id], e);
},
}
}
pub fn remove_slot_job(
senders: ThreadSenders,
plugin_map: Arc<Mutex<PluginMap>>,
instance_id: PluginId,
slot_id: PluginId,
tear_down: bool,
) {
if let Some((running_plugin, _subscriptions)) = lookup(&plugin_map, instance_id) {
let mut running_plugin = runn... |
rust_dataset_chunk_514050 | rust_dataset.txt | 514,050 | 512 | for shared plugin: {:?}", e);
}
let _ = senders.send_to_screen(ScreenInstruction::ClearAllPluginHighlights(instance_id));
}
pub fn client_job(
senders: ThreadSenders,
plugin_map: Arc<Mutex<PluginMap>>,
instance_id: PluginId,
client_id: ClientId,
connected: bool,
) {
let Some((running_p... |
rust_dataset_chunk_514051 | rust_dataset.txt | 514,051 | 512 | _plugin = running_plugin.lock().unwrap();
let before: HashSet<(PluginId, ClientId)> = targets_for(&running_plugin, &RenderResponse::All)
.into_iter()
.collect();
if let Some(shared) = running_plugin.store.data_mut().shared.as_mut() {
shared.visible_slots = visible_slots;
}
let ne... |
rust_dataset_chunk_514052 | rust_dataset.txt | 514,052 | 512 | {
let mut plugin_map = plugin_map.lock().unwrap();
PluginLoader::new(
skip_cache,
loading_context,
senders.clone(),
engine,
plugin_cache,
&mut plugin_map,
connected_clients.clone(),
)
.start_shared_plugi... |
rust_dataset_chunk_514053 | rust_dataset.txt | 514,053 | 512 | .as_bytes());
section.push(0);
section.push(0);
}
let mut bytes = b"\0asm\x01\0\0\0".to_vec();
bytes.push(1);
bytes.push(0);
bytes.push(7);
bytes.push(section.len() as u8);
bytes.extend(section);
bytes
}
#[test]
fn dete... |
rust_dataset_chunk_514054 | rust_dataset.txt | 514,054 | 512 | !(!generations.is_superseded(1, 1, plugin_one));
assert!(generations.is_superseded(2, 1, plugin_two));
assert!(generations.is_superseded(1, 2, other_client));
}
#[test]
fn a_generation_never_queued_is_not_superseded() {
let generations = HoverGenerations::default();
assert!(!generations.is_superseded(7... |
rust_dataset_chunk_514055 | rust_dataset.txt | 514,055 | 512 | ;
use zellij_utils::data::{
BareKey, Event, InputMode, KeyWithModifier, ModeInfo, PermissionStatus, PermissionType,
};
use zellij_utils::errors::ErrorContext;
use zellij_utils::input::actions::Action;
use zellij_utils::input::keybinds::Keybinds;
use zellij_utils::input::layout::{
Layout, PluginAlias, PluginUser... |
rust_dataset_chunk_514056 | rust_dataset.txt | 514,056 | 512 | 1;
log.lock().unwrap().push(event);
if exit_event_count == $exit_after_count {
break;
}
},
_ => {
log.lock().unwrap().push(event... |
rust_dataset_chunk_514057 | rust_dataset.txt | 514,057 | 512 | plugin_thread_sender = $plugin_thread_sender.clone();
let is_done = $is_done;
let deadline = std::time::Instant::now() + std::time::Duration::from_secs(30);
move || loop {
let remaining = deadline.saturating_duration_since(std::time::Instant::now());
... |
rust_dataset_chunk_514058 | rust_dataset.txt | 514,058 | 512 | ().push(event);
},
}
}
})
.unwrap()
};
}
macro_rules! grant_permissions_and_log_actions_in_thread_naked_variant {
( $arc_mutex_log:expr, $exit_event:path, $receiver:expr, $exit_after_count:expr, $permission_type:expr, $cache_pa... |
rust_dataset_chunk_514059 | rust_dataset.txt | 514,059 | 512 | event, _err_ctx) = $receiver
.recv()
.expect("failed to receive event on channel");
match event {
$exit_event { .. } => {
exit_event_count += 1;
log.lock().unwrap().push(ev... |
rust_dataset_chunk_514060 | rust_dataset.txt | 514,060 | 512 | to_pty_writer = SenderWithContext::new(to_pty_writer);
let (to_background_jobs, _background_jobs_receiver): ChannelWithContext<BackgroundJob> =
channels::unbounded();
let to_background_jobs = SenderWithContext::new(to_background_jobs);
let plugin_bus = Bus::new(
vec![plugin_receiver],
... |
rust_dataset_chunk_514061 | rust_dataset.txt | 514,061 | 512 | ::Exit);
let _ = plugin_thread.join();
}
};
(to_plugin, screen_receiver, Box::new(teardown))
}
fn create_plugin_thread_with_server_receiver(
zellij_cwd: Option<PathBuf>,
session_env_vars: Option<std::collections::BTreeMap<String, String>>,
) -> (
SenderWithContext<PluginInstruct... |
rust_dataset_chunk_514062 | rust_dataset.txt | 514,062 | 512 | None; // TODO: change me
let initiating_client_id = 1;
let plugin_thread = std::thread::Builder::new()
.name("plugin_thread".to_string())
.spawn(move || {
set_var("ZELLIJ_SESSION_NAME", "zellij-test");
plugin_thread_main(
plugin_bus,
engin... |
rust_dataset_chunk_514063 | rust_dataset.txt | 514,063 | 512 | _pty, pty_receiver): ChannelWithContext<PtyInstruction> = channels::unbounded();
let to_pty = SenderWithContext::new(to_pty);
let (to_pty_writer, _pty_writer_receiver): ChannelWithContext<PtyWriteInstruction> =
channels::unbounded();
let to_pty_writer = SenderWithContext::new(to_pty_writer);
l... |
rust_dataset_chunk_514064 | rust_dataset.txt | 514,064 | 512 | Instruction::KillSession);
let _ = to_plugin.send(PluginInstruction::Exit);
let _ = plugin_thread.join();
}
};
(to_plugin, pty_receiver, screen_receiver, Box::new(teardown))
}
fn create_plugin_thread_with_background_jobs_receiver(
zellij_cwd: Option<PathBuf>,
session_env... |
rust_dataset_chunk_514065 | rust_dataset.txt | 514,065 | 512 | ().unwrap().path());
let default_shell = PathBuf::from(".");
let default_shell_action = None; // TODO: change me
let initiating_client_id = 1;
let plugin_thread = std::thread::Builder::new()
.name("plugin_thread".to_string())
.spawn(move || {
set_var("ZELLIJ_SESSION_NAME", "z... |
rust_dataset_chunk_514066 | rust_dataset.txt | 514,066 | 512 | fixture plugin does)
// we then listen on our mock screen receiver to make sure we got a PluginBytes instruction
// that contains said render, and assert against it
let temp_folder = tempdir().unwrap(); // placed explicitly in the test scope because its
let plugin_host_folder = PathBuf::from(temp_folde... |
rust_dataset_chunk_514067 | rust_dataset.txt | 514,067 | 512 | (plugin_render_assets) = i {
for plugin_render_asset in plugin_render_assets {
let plugin_id = plugin_render_asset.plugin_id;
let client_id = plugin_render_asset.client_id;
let plugin_bytes = plugin_render_asset.bytes.clone();
... |
rust_dataset_chunk_514068 | rust_dataset.txt | 514,068 | 512 | placed_pane
plugin_title,
run_plugin,
Some(tab_index),
None,
client_id,
size,
None,
None,
false,
None,
None,
None,
));
std::thread::sleep(std::time::Duration::from_millis(500));
let _ = plugin_thread_sender.send(... |
rust_dataset_chunk_514069 | rust_dataset.txt | 514,069 | 512 | screen_thread = grant_permissions_and_log_actions_in_thread!(
received_screen_instructions,
ScreenInstruction::PluginBytes,
screen_receiver,
3,
&PermissionType::ChangeApplicationState,
cache_path,
plugin_thread_sender,
client_id
);
let _ = plugin... |
rust_dataset_chunk_514070 | rust_dataset.txt | 514,070 | 512 | teardown) = create_plugin_thread(None, None);
let plugin_should_float = Some(false);
let plugin_host_folder = PathBuf::from(temp_folder.path());
let cache_path = plugin_host_folder.join("permissions_test.kdl");
let plugin_title = Some("test_plugin".to_owned());
let run_plugin = RunPluginOrAlias::Ru... |
rust_dataset_chunk_514071 | rust_dataset.txt | 514,071 | 512 | Duration::from_millis(500));
let _ = plugin_thread_sender.send(PluginInstruction::Update(vec![(
None,
Some(client_id),
Event::SystemClipboardFailure,
)]));
screen_thread.join().unwrap(); // this might take a while if the cache is cold
teardown();
let plugin_bytes_event = rece... |
rust_dataset_chunk_514072 | rust_dataset.txt | 514,072 | 512 | _sender.send(PluginInstruction::AddClient(client_id));
let _ = plugin_thread_sender.send(PluginInstruction::Load(
plugin_should_float,
false,
false, // close_replaced_pane
plugin_title,
run_plugin,
Some(tab_index),
None,
client_id,
size,
... |
rust_dataset_chunk_514073 | rust_dataset.txt | 514,073 | 512 | default()
});
let tab_index = 1;
let client_id = 1;
let size = Size {
cols: 121,
rows: 20,
};
let received_server_instructions = Arc::new(Mutex::new(vec![]));
let server_thread = log_actions_in_thread!(
received_server_instructions,
ServerInstruction::ChangeMo... |
rust_dataset_chunk_514074 | rust_dataset.txt | 514,074 | 512 | dl");
let (plugin_thread_sender, screen_receiver, teardown) =
create_plugin_thread(Some(plugin_host_folder), None);
let plugin_should_float = Some(false);
let plugin_title = Some("test_plugin".to_owned());
let run_plugin = RunPluginOrAlias::RunPlugin(RunPlugin {
_allow_exec_host_cmd: fal... |
rust_dataset_chunk_514075 | rust_dataset.txt | 514,075 | 512 | dir().unwrap(); // placed explicitly in the test scope because its
// destructor removes the directory
let plugin_host_folder = PathBuf::from(temp_folder.path());
let cache_path = plugin_host_folder.join("permissions_test.kdl");
let (plugin_thread_sender, screen_rec... |
rust_dataset_chunk_514076 | rust_dataset.txt | 514,076 | 512 | None
}
})
.clone();
let second_new_tab_event = received_screen_instructions
.lock()
.unwrap()
.iter()
.rev()
.find_map(|i| {
if let ScreenInstruction::NewTab(..) = i {
Some(i.clone())
} else {
... |
rust_dataset_chunk_514077 | rust_dataset.txt | 514,077 | 512 | (vec![(
None,
Some(client_id),
Event::Key(KeyWithModifier::new(BareKey::Char('c'))), // this triggers a new_tab command in the fixture
// plugin
)]));
screen_thread.join().unwrap(); // this might take a while if the cache is c... |
rust_dataset_chunk_514078 | rust_dataset.txt | 514,078 | 512 | ,
None,
None,
None,
));
std::thread::sleep(std::time::Duration::from_millis(500));
let _ = plugin_thread_sender.send(PluginInstruction::Update(vec![(
None,
Some(client_id),
Event::Key(KeyWithModifier::new(BareKey::Char('d'))), // this triggers the event in the... |
rust_dataset_chunk_514079 | rust_dataset.txt | 514,079 | 512 | , // close_replaced_pane
plugin_title,
run_plugin,
Some(tab_index),
None,
client_id,
size,
None,
None,
false,
None,
None,
None,
));
std::thread::sleep(std::time::Duration::from_millis(500));
let _ = plugin_thread... |
rust_dataset_chunk_514080 | rust_dataset.txt | 514,080 | 512 | = plugin_thread_sender.send(PluginInstruction::AddClient(client_id));
let _ = plugin_thread_sender.send(PluginInstruction::Load(
plugin_should_float,
false,
false, // close_replaced_pane
plugin_title,
run_plugin,
Some(tab_index),
None,
client_id,
... |
rust_dataset_chunk_514081 | rust_dataset.txt | 514,081 | 512 | ::Resize,
screen_receiver,
1,
&PermissionType::ChangeApplicationState,
cache_path,
plugin_thread_sender,
client_id
);
let _ = plugin_thread_sender.send(PluginInstruction::AddClient(client_id));
let _ = plugin_thread_sender.send(PluginInstruction::Load(
... |
rust_dataset_chunk_514082 | rust_dataset.txt | 514,082 | 512 | received_screen_instructions = Arc::new(Mutex::new(vec![]));
let screen_thread = grant_permissions_and_log_actions_in_thread!(
received_screen_instructions,
ScreenInstruction::FocusNextPane,
screen_receiver,
1,
&PermissionType::ChangeApplicationState,
cache_path,
... |
rust_dataset_chunk_514083 | rust_dataset.txt | 514,083 | 512 | });
let tab_index = 1;
let client_id = 1;
let size = Size {
cols: 121,
rows: 20,
};
let received_screen_instructions = Arc::new(Mutex::new(vec![]));
let screen_thread = grant_permissions_and_log_actions_in_thread!(
received_screen_instructions,
ScreenInstructi... |
rust_dataset_chunk_514084 | rust_dataset.txt | 514,084 | 512 | _allow_exec_host_cmd: false,
location: RunPluginLocation::File(PathBuf::from(&*PLUGIN_FIXTURE)),
configuration: Default::default(),
..Default::default()
});
let tab_index = 1;
let client_id = 1;
let size = Size {
cols: 121,
rows: 20,
};
let receive... |
rust_dataset_chunk_514085 | rust_dataset.txt | 514,085 | 512 | , teardown) =
create_plugin_thread(Some(plugin_host_folder), None);
let plugin_should_float = Some(false);
let plugin_title = Some("test_plugin".to_owned());
let run_plugin = RunPluginOrAlias::RunPlugin(RunPlugin {
_allow_exec_host_cmd: false,
location: RunPluginLocation::File(PathBu... |
rust_dataset_chunk_514086 | rust_dataset.txt | 514,086 | 512 | directory
let plugin_host_folder = PathBuf::from(temp_folder.path());
let cache_path = plugin_host_folder.join("permissions_test.kdl");
let (plugin_thread_sender, screen_receiver, teardown) =
create_plugin_thread(Some(plugin_host_folder), None);
let plugin_should_float = Some(false);
let pl... |
rust_dataset_chunk_514087 | rust_dataset.txt | 514,087 | 512 | new_tab_event));
}
#[test]
#[ignore]
pub fn edit_scrollback_plugin_command() {
let temp_folder = tempdir().unwrap(); // placed explicitly in the test scope because its
// destructor removes the directory
let plugin_host_folder = PathBuf::from(temp_folder.path());
... |
rust_dataset_chunk_514088 | rust_dataset.txt | 514,088 | 512 | ScreenInstruction::EditScrollback(..) = i {
Some(i.clone())
} else {
None
}
})
.clone();
assert_snapshot!(format!("{:#?}", new_tab_event));
}
#[test]
#[ignore]
pub fn write_plugin_command() {
let temp_folder = tempdir().unwrap(); // place... |
rust_dataset_chunk_514089 | rust_dataset.txt | 514,089 | 512 |
teardown();
let new_tab_event = received_screen_instructions
.lock()
.unwrap()
.iter()
.find_map(|i| {
if let ScreenInstruction::WriteCharacter(..) = i {
Some(i.clone())
} else {
None
}
})
.clone... |
rust_dataset_chunk_514090 | rust_dataset.txt | 514,090 | 512 | Char('o'))), // this triggers the enent in the fixture plugin
)]));
screen_thread.join().unwrap(); // this might take a while if the cache is cold
teardown();
let new_tab_event = received_screen_instructions
.lock()
.unwrap()
.iter()
.find_map(|i| {
if let Scr... |
rust_dataset_chunk_514091 | rust_dataset.txt | 514,091 | 512 | let _ = plugin_thread_sender.send(PluginInstruction::Update(vec![(
None,
Some(client_id),
Event::Key(KeyWithModifier::new(BareKey::Char('p'))), // this triggers the enent in the fixture plugin
)]));
screen_thread.join().unwrap(); // this might take a while if the cache is cold
teard... |
rust_dataset_chunk_514092 | rust_dataset.txt | 514,092 | 512 | ,
None,
false,
None,
None,
None,
));
std::thread::sleep(std::time::Duration::from_millis(500));
let _ = plugin_thread_sender.send(PluginInstruction::Update(vec![(
None,
Some(client_id),
Event::Key(KeyWithModifier::new(BareKey::Char('q'))), // t... |
rust_dataset_chunk_514093 | rust_dataset.txt | 514,093 | 512 | _float,
false,
false, // close_replaced_pane
plugin_title,
run_plugin,
Some(tab_index),
None,
client_id,
size,
None,
None,
false,
None,
None,
None,
));
std::thread::sleep(std::time::Duration::from_mil... |
rust_dataset_chunk_514094 | rust_dataset.txt | 514,094 | 512 |
);
let _ = plugin_thread_sender.send(PluginInstruction::AddClient(client_id));
let _ = plugin_thread_sender.send(PluginInstruction::Load(
plugin_should_float,
false,
false, // close_replaced_pane
plugin_title,
run_plugin,
Some(tab_index),
None,
... |
rust_dataset_chunk_514095 | rust_dataset.txt | 514,095 | 512 | ScreenInstruction::ScrollUp,
screen_receiver,
1,
&PermissionType::ChangeApplicationState,
cache_path,
plugin_thread_sender,
client_id
);
let _ = plugin_thread_sender.send(PluginInstruction::AddClient(client_id));
let _ = plugin_thread_sender.send(Plug... |
rust_dataset_chunk_514096 | rust_dataset.txt | 514,096 | 512 | };
let received_screen_instructions = Arc::new(Mutex::new(vec![]));
let screen_thread = grant_permissions_and_log_actions_in_thread!(
received_screen_instructions,
ScreenInstruction::ScrollDown,
screen_receiver,
1,
&PermissionType::ChangeApplicationState,
cache_p... |
rust_dataset_chunk_514097 | rust_dataset.txt | 514,097 | 512 | });
let tab_index = 1;
let client_id = 1;
let size = Size {
cols: 121,
rows: 20,
};
let received_screen_instructions = Arc::new(Mutex::new(vec![]));
let screen_thread = grant_permissions_and_log_actions_in_thread!(
received_screen_instructions,
ScreenInstructi... |
rust_dataset_chunk_514098 | rust_dataset.txt | 514,098 | 512 | _allow_exec_host_cmd: false,
location: RunPluginLocation::File(PathBuf::from(&*PLUGIN_FIXTURE)),
configuration: Default::default(),
..Default::default()
});
let tab_index = 1;
let client_id = 1;
let size = Size {
cols: 121,
rows: 20,
};
let received_scree... |
rust_dataset_chunk_514099 | rust_dataset.txt | 514,099 | 512 | let plugin_should_float = Some(false);
let plugin_title = Some("test_plugin".to_owned());
let run_plugin = RunPluginOrAlias::RunPlugin(RunPlugin {
_allow_exec_host_cmd: false,
location: RunPluginLocation::File(PathBuf::from(&*PLUGIN_FIXTURE)),
configuration: Default::default(),
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.