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_512700 | rust_dataset.txt | 512,700 | 512 | ping_interval_ms = crate::nested_guest::ping_interval_ms();
async move {
while flag.load(Ordering::SeqCst) {
let _ = senders.send_to_screen(
ScreenInstruction::NestedGuestPingTick { pane_id },
... |
rust_dataset_chunk_512701 | rust_dataset.txt | 512,701 | 512 | } else {
crate::session_previews::running_session_preview(
&session_name,
tab_index,
pane_id,
anchor,
)
};
let _ = send... |
rust_dataset_chunk_512702 | rust_dataset.txt | 512,702 | 512 | ONG_FLASH_DURATION_MS)
{
*current_running_job_start_time = Instant::now();
false
} else {
true
}
},
None => {
running_jobs.insert(job.clone(), Instant::now());
false
},
}
}
fn file_co... |
rust_dataset_chunk_512703 | rust_dataset.txt | 512,703 | 512 | }
}
pub fn scan_session_list(
current_session_name: &str,
available_layouts: &[LayoutInfo],
current_session_plugin_list: &BTreeMap<PluginId, RunPlugin>,
sock_dir: &Path,
session_info_cache_dir: &Path,
) -> (BTreeMap<String, SessionInfo>, BTreeMap<String, Duration>) {
let mut session_infos_on_m... |
rust_dataset_chunk_512704 | rust_dataset.txt | 512,704 | 512 | return None;
}
let session_name = names_by_id.get(&id).cloned().unwrap_or_else(|| id.clone());
if session_infos_on_machine.contains_key(&session_name) {
// this is not a dead session...
re... |
rust_dataset_chunk_512705 | rust_dataset.txt | 512,705 | 512 | )]
mod tests {
use super::*;
use std::os::unix::net::UnixListener;
use tempfile::tempdir;
use zellij_utils::data::SessionInfo;
fn make_socket(dir: &std::path::Path, name: &str) -> UnixListener {
UnixListener::bind(dir.join(name)).expect("bind unix socket")
}
fn write_metadata(info_... |
rust_dataset_chunk_512706 | rust_dataset.txt | 512,706 | 512 | ) = scan_session_list(
"me",
&[],
&BTreeMap::new(),
sock_dir.path(),
info_dir.path(),
);
assert!(live.is_empty());
assert_eq!(resurrectable.len(), 1);
assert!(resurrectable.contains_key("dead-beta"));
}
#[test]
fn s... |
rust_dataset_chunk_512707 | rust_dataset.txt | 512,707 | 512 | <_>>(), vec!["exited"]);
let read = zellij_utils::sessions::read_live_session_states(
"me",
sock_dir.path(),
info_dir.path(),
);
assert_eq!(read.keys().collect::<Vec<_>>(), vec!["visible"]);
}
}
async fn run_in_background(
command: PathBuf,
args: ... |
rust_dataset_chunk_512708 | rust_dataset.txt | 512,708 | 512 | = RenderSchedule::default();
assert!(schedule.request(start));
let later = start + RENDER_QUIET_PERIOD / 2;
assert!(!schedule.request(later));
assert_eq!(
schedule.step(start + RENDER_QUIET_PERIOD),
RenderStep::WaitFor(RENDER_QUIET_PERIOD / 2)
);
... |
rust_dataset_chunk_512709 | rust_dataset.txt | 512,709 | 512 | let mut schedule = RenderSchedule::default();
assert!(schedule.request(start));
let later = start + RENDER_QUIET_PERIOD / 4;
assert_eq!(
schedule.step(later),
RenderStep::WaitFor(RENDER_QUIET_PERIOD * 3 / 4)
);
schedule.request_now(later);
assert_... |
rust_dataset_chunk_512710 | rust_dataset.txt | 512,710 | 512 | S, cmd removes only the outer quotes added here, so quotes in the
// command stay as written. /D skips AutoRun commands from the registry,
// which would otherwise run first and add to the output.
BackgroundCommand {
program: "cmd".to_owned(),
args: ve... |
rust_dataset_chunk_512711 | rust_dataset.txt | 512,711 | 512 | Ok(BackgroundCommandOutput {
exit_code: output.status.code(),
stdout: output.stdout,
stderr: output.stderr,
})
}
pub fn run_background_command_blocking(
command: BackgroundCommand,
) -> std::result::Result<BackgroundCommandOutput, BackgroundCommandError> {
crate::global_async_runti... |
rust_dataset_chunk_512712 | rust_dataset.txt | 512,712 | 512 | ---
//! Classified representation of the host-terminal queries Zellij
//! forwards on behalf of apps running inside panes.
//!
//! The grid dispatcher already parses incoming OSC / CSI sequences
//! via `vte`; rather than stashing the raw bytes and re-parsing them
//! at the reply-synthesis stage, we capture the class... |
rust_dataset_chunk_512713 | rust_dataset.txt | 512,713 | 512 | minator,
},
ClipboardContent {
selection: char,
terminator: OscTerminator,
},
/// `CSI ? 996 n` — query the host terminal's color-palette theme
/// mode (light or dark). NOT forwarded to the host. Zellij has
/// already queried the host once at startup (via the client's
/// `... |
rust_dataset_chunk_512714 | rust_dataset.txt | 512,714 | 512 | // total without dirtying the wire format. Callers that
// bypass `Screen::forward_host_query` for this variant
// shouldn't be calling `to_query_bytes` on it at all.
HostQuery::ColorPaletteMode => Vec::new(),
}
}
pub fn empty_reply_bytes(&self) -> Vec<u8... |
rust_dataset_chunk_512715 | rust_dataset.txt | 512,715 | 512 | Terminator::St,
}
.to_query_bytes(),
b"\x1b]4;255;?\x1b\\",
);
}
#[test]
fn clipboard_content_carries_selection_and_terminator() {
assert_eq!(
HostQuery::ClipboardContent {
selection: 'c',
terminator: OscTermina... |
rust_dataset_chunk_512716 | rust_dataset.txt | 512,716 | 512 | ;
mod desktop_app;
pub use desktop_app::{set_app_starter, AppStarter};
mod global_async_runtime;
mod logging_pipe;
mod mobile_web;
pub mod nested_guest;
pub mod notifications;
mod pane_groups;
pub mod pane_mirror;
mod plugins;
mod pty;
mod pty_writer;
mod route;
mod screen;
mod session_layout_metadata;
pub mod session_... |
rust_dataset_chunk_512717 | rust_dataset.txt | 512,717 | 512 | config::{
load_config_file, watch_config_file_changes, watch_keybinds_dir_changes,
watch_layout_dir_changes, Config,
},
config_blocks,
config_file_edit::{read_config_file, save_config_in_place, SaveOutcome},
config_settings,
keybind_presets::{
... |
rust_dataset_chunk_512718 | rust_dataset.txt | 512,718 | 512 | SwitchSession(ConnectToSession, ClientId, Option<NotificationEnd>),
SwitchSessionAndCloseCurrent(ConnectToSession, ClientId, Option<NotificationEnd>),
HistoryMove(
zellij_utils::session_history::HistoryMove,
ClientId,
Option<NotificationEnd>,
),
TerminalCommandSubmitted,
... |
rust_dataset_chunk_512719 | rust_dataset.txt | 512,719 | 512 | , String>>,
},
DeleteThemeFile {
client_id: ClientId,
name: String,
response_channel: crossbeam::channel::Sender<Result<String, String>>,
},
RebindKeys {
client_id: ClientId,
keys_to_rebind: Vec<(InputMode, KeyWithModifier, Vec<Action>)>,
keys_to_unbind: V... |
rust_dataset_chunk_512720 | rust_dataset.txt | 512,720 | 512 | ::AttachClient(..) => ServerContext::AttachClient,
ServerInstruction::AttachWatcherClient(..) => ServerContext::AttachClient,
ServerInstruction::ConnStatus(..) => ServerContext::ConnStatus,
ServerInstruction::Log(..) => ServerContext::Log,
ServerInstruction::LogError(..) ... |
rust_dataset_chunk_512721 | rust_dataset.txt | 512,721 | 512 | bindPreset { .. } => ServerContext::CopyKeybindPreset,
ServerInstruction::SaveKeybindsAsPreset { .. } => ServerContext::SaveKeybindsAsPreset,
ServerInstruction::WriteThemeFile { .. } => ServerContext::WriteThemeFile,
ServerInstruction::DeleteThemeFile { .. } => ServerContext::DeleteT... |
rust_dataset_chunk_512722 | rust_dataset.txt | 512,722 | 512 | , Clone, Default)]
struct LayoutSettings {
file_values: Config,
layout_values: Config,
in_use: BTreeSet<SettingKey>,
}
fn settings_without_keybinds(first: &Config, second: &Config) -> BTreeSet<SettingKey> {
config_settings::differing_settings(first, second)
.into_iter()
.filter(|key| *k... |
rust_dataset_chunk_512723 | rust_dataset.txt | 512,723 | 512 | })
};
}
fn apply_layout_settings(&mut self, new_saved_config: &mut Config) {
let Some(layout_settings) = self.layout_settings.as_mut() else {
return;
};
let LayoutSettings {
ref file_values,
ref layout_values,
ref mut in... |
rust_dataset_chunk_512724 | rust_dataset.txt | 512,724 | 512 | pub fn take_base_mode_change(&mut self, client_id: ClientId, base_mode: InputMode) -> bool {
match self.base_modes.insert(client_id, base_mode) {
Some(previous_base_mode) => previous_base_mode != base_mode,
None => false,
}
}
pub fn client_ids(&self) -> Vec<ClientId> {
... |
rust_dataset_chunk_512725 | rust_dataset.txt | 512,725 | 512 | );
let theme_dir = config_blocks::theme_dir(&config)
.ok_or_else(|| "There is no theme folder to write the theme to".to_owned())?;
match copy_from {
Some(from) => {
if config.themes.get_theme(name).is_some() {
return Err(format!("A theme called... |
rust_dataset_chunk_512726 | rust_dataset.txt | 512,726 | 512 | file in {} defines the theme {}",
theme_dir.display(),
name
)
})?;
config_blocks::delete_theme_from_file(&path, name)?;
let replacement = config_blocks::theme_files(&theme_dir)
.remove(name)
.and_then(|other| Th... |
rust_dataset_chunk_512727 | rust_dataset.txt | 512,727 | 512 | _line_settings.get(&client_id) {
for key in &command_line_settings.in_use {
config_settings::copy_setting(
&mut rebased_config,
&command_line_settings.values,
*key,
);
}
... |
rust_dataset_chunk_512728 | rust_dataset.txt | 512,728 | 512 | _menu_items: config_settings::context_menu_lines(¤t),
blocks: config_blocks::config_blocks(¤t, true, Some((&keybinds_vec, base_mode))),
saved_blocks: config_blocks::config_blocks(saved, false, None),
default_blocks: config_blocks::config_blocks(
config_set... |
rust_dataset_chunk_512729 | rust_dataset.txt | 512,729 | 512 | &mut self,
client_id: &ClientId,
key: SettingKey,
) -> Option<Config> {
let current = self.get_client_configuration(client_id);
let mut unset = current.clone();
config_settings::unset_setting(&mut unset, key);
self.forget_command_line_settings(client_id, [key]);
... |
rust_dataset_chunk_512730 | rust_dataset.txt | 512,730 | 512 | client_id: &ClientId) -> &Keybinds {
self.runtime_config
.get(client_id)
.map(|c| c.keybinds.as_ref())
.unwrap_or(self.saved_config.keybinds.as_ref())
}
pub fn get_client_default_input_mode(&self, client_id: &ClientId) -> InputMode {
self.runtime_config
... |
rust_dataset_chunk_512731 | rust_dataset.txt | 512,731 | 512 | overwrite: bool,
) -> SaveOutcome {
save_config_in_place(
config_file_path,
last_read,
&self.saved_config,
base,
target,
overwrite,
)
}
#[cfg(test)]
pub fn save_client_config_to_file(
&self,
client_i... |
rust_dataset_chunk_512732 | rust_dataset.txt | 512,732 | 512 | _id, touched_settings);
match self.replace_runtime_config_if_changed(client_id, current, replaced) {
Some(new_config) => (Some(new_config), true),
None => (None, false),
}
}
pub fn reset_keys(
&mut self,
client_id: &ClientId,
keys: Vec<(InputMode, ... |
rust_dataset_chunk_512733 | rust_dataset.txt | 512,733 | 512 | (|attribute| keybinds.get(*attribute).is_some())
})
.unwrap_or(false)
}
#[derive(Debug, Clone, Default)]
pub(crate) struct KeybindsDirWatcher {
watched_dir: Option<PathBuf>,
stop: Option<Arc<AtomicBool>>,
}
impl KeybindsDirWatcher {
pub fn watched_dir(&self) -> Option<&PathBuf> {
s... |
rust_dataset_chunk_512734 | rust_dataset.txt | 512,734 | 512 | JoinHandle<()>>,
background_jobs_thread: Option<thread::JoinHandle<()>>,
config_file_path: Option<PathBuf>,
config_file: ConfigFileState,
applied_env: AppliedEnv,
sent_terminal_settings: HashMap<ClientId, TerminalSettings>,
font_families: HashMap<ClientId, Vec<String>>,
pub live_sessions: cr... |
rust_dataset_chunk_512735 | rust_dataset.txt | 512,735 | 512 | s, &InputMode, InputMode)> {
// (keybinds, current_input_mode,
// default_input_mode)
let client_keybinds = self.session_configuration.get_client_keybinds(client_id);
let default_input_mode = self
.session_configuration
.get_client_default_input_mode(client_id);
... |
rust_dataset_chunk_512736 | rust_dataset.txt | 512,736 | 512 | self.senders.to_plugin.clone() else {
return;
};
watcher.restart(new_dir.clone(), to_plugin.clone());
let active_preset_files: Vec<PathBuf> = config
.active_keybind_preset_file()
.filter(|_| config.keybinds_layers.active.info.source == KeybindPresetSource::Fi... |
rust_dataset_chunk_512737 | rust_dataset.txt | 512,737 | 512 | ='{}' not found in themes; auto-theme switch disabled for light.",
new_config.options.theme_light.as_deref().unwrap_or("?")
);
}
let pane_frame_style = PaneFrameStyle::from_options(&new_config.options);
let shared_keybinds = match converted_keybind... |
rust_dataset_chunk_512738 | rust_dataset.txt | 512,738 | 512 | ui
.pane_frames
.resolved_floating_border_style(),
stacked_resize: new_config.options.stacked_resize.unwrap_or(true),
stacked_pane_list: new_config.options.stacked_pane_list.unwrap_or(true),
default_editor: new_c... |
rust_dataset_chunk_512739 | rust_dataset.txt | 512,739 | 512 | .unwrap_or(true),
));
let _ = self
.senders
.send_to_screen(ScreenInstruction::SetLiveViewReleaseKey(
new_config.options.live_view_release_key.clone(),
));
let _ = self.senders.send_to_scr... |
rust_dataset_chunk_512740 | rust_dataset.txt | 512,740 | 512 | DetectPluginConfigChanges(new_plugins))
.unwrap();
}
}
}
}
impl Drop for SessionMetaData {
fn drop(&mut self) {
if let Some(watcher) = self.config_file.keybinds_dir_watcher.as_mut() {
watcher.stop();
}
let _ = self
.senders... |
rust_dataset_chunk_512741 | rust_dataset.txt | 512,741 | 512 | _empty() {
return;
}
if let Some(session) = session_data.read().unwrap().as_ref() {
for token in stuck_tokens {
let _ = session
.senders
.send_to_screen(ScreenInstruction::ForwardedReplyFromHost {
token,
reply_by... |
rust_dataset_chunk_512742 | rust_dataset.txt | 512,742 | 512 | /// specific client and are waiting for a reply. Used to clean up
/// when that client disconnects (or when there's no client to
/// dispatch to in the first place) — each stuck token gets an
/// empty synthetic reply so `Screen`'s `forward_in_flight` slot
/// releases and the queued forwards keep m... |
rust_dataset_chunk_512743 | rust_dataset.txt | 512,743 | 512 | ) {
self.pipes.insert(pipe_id, client_id);
}
/// Remove a client and return any host-query tokens that had
/// been dispatched to this client and were still awaiting a
/// reply. Callers must synthesize an empty reply for each token
/// (via `ScreenInstruction::ForwardedReplyFromHost`) so
... |
rust_dataset_chunk_512744 | rust_dataset.txt | 512,744 | 512 | if is_web_client {
Some(c_id)
} else {
None
}
},
)
.collect()
}
pub fn get_pipe(&self, pipe_name: &str) -> Option<ClientId> {
self.pipes.get(pipe_name).copied()
}
pub ... |
rust_dataset_chunk_512745 | rust_dataset.txt | 512,745 | 512 | }
}
self.clients.keys().copied().next()
}
}
#[derive(Debug, Clone, Default)]
pub(crate) struct AppliedEnv {
config: HashMap<String, String>,
original_values: HashMap<String, Option<String>>,
}
impl AppliedEnv {
fn at_startup(env: &HashMap<String, String>) -> Self {
... |
rust_dataset_chunk_512746 | rust_dataset.txt | 512,746 | 512 | set_var(inherited, "from the shell");
let mut applied = AppliedEnv::default();
applied.sync(&wanted(&[(name, "first"), (inherited, "from the config")]));
assert_eq!(
applied.pane_env().get(inherited),
Some(&Some("from the config".to_owned()))
);
assert!(st... |
rust_dataset_chunk_512747 | rust_dataset.txt | 512,747 | 512 | .pane_env().get(set_before),
Some(&Some("again".to_owned()))
);
}
#[test]
fn a_startup_variable_without_an_earlier_value_is_unset_in_new_panes_when_removed() {
let name = "ZELLIJ_SESSION_12_ENV_STARTUP_NEW";
let mut applied = AppliedEnv::at_startup_with(&wanted(&[(name, ... |
rust_dataset_chunk_512748 | rust_dataset.txt | 512,748 | 512 | config.keybinds, &config.clone().keybinds));
let mut session_configuration = SessionConfiguration::default();
session_configuration.set_saved_configuration(config.clone());
session_configuration.set_client_runtime_configuration(1, config.clone());
session_configuration.set_client_runtime... |
rust_dataset_chunk_512749 | rust_dataset.txt | 512,749 | 512 | .get_client_keybinds(&2)
.get_actions_for_key_in_mode(&InputMode::Normal, &alt_f1),
config
.keybinds
.get_actions_for_key_in_mode(&InputMode::Normal, &alt_f1)
);
let (_, changed) =
session_configuration.reconfigure_... |
rust_dataset_chunk_512750 | rust_dataset.txt | 512,750 | 512 | _client_runtime_configuration(1, saved_config);
session_configuration
}
fn current_value(
session_configuration: &SessionConfiguration,
key: SettingKey,
) -> Option<String> {
config_settings::setting_value(&session_configuration.get_client_configuration(&1), key)
}
... |
rust_dataset_chunk_512751 | rust_dataset.txt | 512,751 | 512 |
.plugin_aliases
.iter()
.any(|alias| alias.name == "configuration"));
assert!(snapshot
.plugin_aliases
.iter()
.any(|alias| alias.starts_with("configuration")));
}
#[test]
fn reverting_one_setting_restores_its_saved_value_and_... |
rust_dataset_chunk_512752 | rust_dataset.txt | 512,752 | 512 | Key::ExplicitThemeHue);
assert!(unset.is_some());
assert_eq!(
current_value(&session_configuration, SettingKey::ExplicitThemeHue),
None
);
let snapshot = session_configuration.config_snapshot(&1, None);
assert!(snapshot
.setting(SettingKey::Exp... |
rust_dataset_chunk_512753 | rust_dataset.txt | 512,753 | 512 | current_value(&session_configuration, SettingKey::SimplifiedUi),
Some("true".to_owned())
);
assert_eq!(
config_settings::setting_value(
&session_configuration.get_client_configuration(&2),
SettingKey::PaneFrames
),
... |
rust_dataset_chunk_512754 | rust_dataset.txt | 512,754 | 512 | locked_mode_action(&session_configuration, "Ctrl u").is_some());
}
#[test]
fn a_change_in_the_keybinds_folder_is_picked_up() {
let config_dir = tempfile::tempdir().unwrap();
let keybinds_dir = config_dir.path().join("keybinds");
std::fs::create_dir_all(&keybinds_dir).unwrap();
... |
rust_dataset_chunk_512755 | rust_dataset.txt | 512,755 | 512 | _with_one_client("mouse_mode false");
let saved_config = session_configuration.saved_config.clone();
session_configuration.set_client_runtime_configuration(
2,
runtime_config_with_command_line_preset(&saved_config, "unlock-first"),
);
assert!(session_configuratio... |
rust_dataset_chunk_512756 | rust_dataset.txt | 512,756 | 512 | _config.clone());
session_configuration.set_client_runtime_configuration(
1,
runtime_config_with_command_line_preset(&saved_config, "unlock-first"),
);
session_configuration
.reconfigure_runtime_config(&1, "keybinds preset=\"default\"".to_owned());
l... |
rust_dataset_chunk_512757 | rust_dataset.txt | 512,757 | 512 | binds_dir).unwrap();
let preset_path = keybinds_dir.join("mine.kdl");
let load = || {
let mut base = Config::from_default_assets().unwrap();
base.keybinds_layers.config_dir = Some(config_dir.path().to_path_buf());
Config::from_kdl("keybinds preset=\"mine\"", Some(base... |
rust_dataset_chunk_512758 | rust_dataset.txt | 512,758 | 512 | _configuration_with_one_client(FILE_WITH_COMMENTS);
session_configuration.reconfigure_runtime_config(&1, "mouse_mode true".to_owned());
session_configuration
.reconfigure_runtime_config(&1, "keybinds preset=\"unlock-first\"".to_owned());
let outcome = session_configuration.save_clien... |
rust_dataset_chunk_512759 | rust_dataset.txt | 512,759 | 512 | {
let (_config_dir, path) = config_file_with(FILE_WITH_COMMENTS);
let mut session_configuration = session_configuration_with_one_client(FILE_WITH_COMMENTS);
let before = session_configuration.get_client_configuration(&1);
let (after, _) = session_configuration.reconfigure_runtime_config... |
rust_dataset_chunk_512760 | rust_dataset.txt | 512,760 | 512 | _mode(&InputMode::Normal, &alt_n)
.is_none());
let (_, did_change) =
session_configuration.reset_keys(&1, vec![(InputMode::Normal, alt_n.clone())]);
assert!(did_change);
let reset = session_configuration.get_client_configuration(&1);
assert!(reset
.key... |
rust_dataset_chunk_512761 | rust_dataset.txt | 512,761 | 512 | fn saving_after_an_outside_change_reports_it_and_writes_nothing() {
let (_config_dir, path) = config_file_with(FILE_WITH_COMMENTS);
let mut session_configuration = session_configuration_with_one_client(FILE_WITH_COMMENTS);
session_configuration.reconfigure_runtime_config(&1, "mouse_mode true".t... |
rust_dataset_chunk_512762 | rust_dataset.txt | 512,762 | 512 | sthrough_clients: HashMap::new(),
popup_clients: HashSet::new(),
modal_popup_clients: HashSet::new(),
live_view_captures: Default::default(),
terminal_command_submitted: Arc::new(std::sync::atomic::AtomicBool::new(false)),
web_sharing: WebSharing::Off,
... |
rust_dataset_chunk_512763 | rust_dataset.txt | 512,763 | 512 | emphasis_3 0 0 0
}
}
second {
text_unselected {
base 2 2 2
background 2 2 2
emphasis_0 0 0 0
emphasis_1 0 0 0
emphasis_2 0 0 0
emphasis_3 0 0 0
}
}
}
theme \"first\"
";
#[test]
fn terminal_settings_are_... |
rust_dataset_chunk_512764 | rust_dataset.txt | 512,764 | 512 | _owned()]);
session_data
.write()
.unwrap()
.as_mut()
.unwrap()
.forget_window_client(1);
{
let session = session_data.read().unwrap();
let session = session.as_ref().unwrap();
assert!(session.sent_terminal... |
rust_dataset_chunk_512765 | rust_dataset.txt | 512,765 | 512 | .unwrap()
.session_configuration
.reconfigure_runtime_config(&client_id, config.to_owned());
apply_runtime_change(
config_before,
new_config,
write_config_to_disk,
changed,
session_data,
client_id,
... |
rust_dataset_chunk_512766 | rust_dataset.txt | 512,766 | 512 | ) = config_file_with(FILE_WITH_COMMENTS);
let mut session_configuration = session_configuration_with_one_client(FILE_WITH_COMMENTS);
session_configuration
.set_client_runtime_configuration(2, session_configuration.saved_config.clone());
let (session_data, _screen_receiver, plugin_rec... |
rust_dataset_chunk_512767 | rust_dataset.txt | 512,767 | 512 | , _)| matches!(
instruction,
PluginInstruction::ConfigFileChangedSinceRead(..)
)));
}
fn session_configuration_with_command_line_pane_frames(
file_contents: &str,
) -> SessionConfiguration {
let mut session_configuration = session_configuration_with_one_clien... |
rust_dataset_chunk_512768 | rust_dataset.txt | 512,768 | 512 | _value() {
let (_config_dir, path) = config_file_with(FILE_WITH_COMMENTS);
let mut session_configuration =
session_configuration_with_command_line_pane_frames(FILE_WITH_COMMENTS);
session_configuration.reconfigure_runtime_config(&1, "pane_frames true".to_owned());
assert!(ses... |
rust_dataset_chunk_512769 | rust_dataset.txt | 512,769 | 512 | receiver: &zellij_utils::channels::Receiver<(
PluginInstruction,
zellij_utils::errors::ErrorContext,
)>,
) -> Vec<String> {
loop {
let (instruction, _) = receiver
.recv_timeout(std::time::Duration::from_secs(10))
.expect("no... |
rust_dataset_chunk_512770 | rust_dataset.txt | 512,770 | 512 | _clients() {
let s = SessionState::new();
assert_eq!(s.pick_forward_target(), None);
}
#[test]
fn remove_client_returns_stuck_forward_tokens() {
let mut s = with_client(1);
s.mark_forward_in_flight(10, 1);
s.mark_forward_in_flight(11, 1);
// A forward dispatc... |
rust_dataset_chunk_512771 | rust_dataset.txt | 512,771 | 512 | handler (terminate on Ctrl+C).
//
use windows_sys::Win32::System::Console::SetConsoleCtrlHandler;
unsafe {
SetConsoleCtrlHandler(None, 0);
}
}
start_server_impl(os_input, socket_path, true);
}
fn handle_new_connection(
session_data: Arc<RwLock<Option<SessionMet... |
rust_dataset_chunk_512772 | rust_dataset.txt | 512,772 | 512 | .read()
.unwrap()
.as_ref()
.map(|s| s.senders.clone());
let preview = crate::session_previews::answer_preview_request(
senders.as_ref(),
tab_index,
pane_id,
anchor,
);... |
rust_dataset_chunk_512773 | rust_dataset.txt | 512,773 | 512 | first_instruction: ClientToServerMsg,
#[cfg(windows)] reply_stream: interprocess::local_socket::Stream,
) -> Result<()> {
let client_id = session_state.write().unwrap().new_client();
#[cfg(windows)]
let registered = os_input.register_client_with_reply(client_id, reply_stream);
#[cfg(not(windows))]... |
rust_dataset_chunk_512774 | rust_dataset.txt | 512,774 | 512 | .
let held = lock.metadata()?;
match std::fs::metadata(&lock_path) {
Ok(current) if current.dev() == held.dev() && current.ino() == held.ino() => {
return Ok(SocketOwnership { lock, lock_path });
},
_ => continue,
}
... |
rust_dataset_chunk_512775 | rust_dataset.txt | 512,775 | 512 | = SocketOwnership::acquire(&path)?;
drop(std::fs::remove_file(&path));
let listener = zellij_utils::consts::ipc_bind(&path)?;
*self.ownership.lock().unwrap() = Some(ownership);
Ok(listener)
}
fn rename(&self, new_path: PathBuf) -> std::io::Result<()> {
let mut ownership... |
rust_dataset_chunk_512776 | rust_dataset.txt | 512,776 | 512 | ());
let _listener = server.bind().unwrap();
assert!(path.exists());
server.remove_on_exit();
assert!(!path.exists());
}
#[cfg(unix)]
#[test]
fn a_second_server_cannot_take_over_the_socket_of_a_running_server() {
let dir = tempfile::tempdir().unwrap();
... |
rust_dataset_chunk_512777 | rust_dataset.txt | 512,777 | 512 | !(server.path(), old_path);
assert!(old_path.exists());
assert!(!new_path.exists());
assert!(zellij_utils::consts::ipc_connect(&old_path).is_ok());
}
#[cfg(unix)]
#[test]
fn a_renamed_server_moves_its_socket_and_lock_and_removes_them_on_exit() {
let dir = tempfile::tempd... |
rust_dataset_chunk_512778 | rust_dataset.txt | 512,778 | 512 | file_name()
.map(|f| f.to_string_lossy().to_string())
.unwrap_or_default();
envs::set_session_id(&session_id);
let session_was_resurrected = !session_id.is_empty()
&& zellij_utils::consts::session_layout_cache_file_name(&session_id).exists();
let (to_server, server_receiver): Channe... |
rust_dataset_chunk_512779 | rust_dataset.txt | 512,779 | 512 | platforms allow setting the sticky bit on sockets!
#[cfg(unix)]
drop(set_permissions(&socket_path, 0o1700));
let route = |stream: interprocess::local_socket::Stream,
#[cfg(windows)] reply_stream: interprocess::local_socket::Stream| {
... |
rust_dataset_chunk_512780 | rust_dataset.txt | 512,780 | 512 | _client_count = session_state.read().unwrap().attached_client_count();
if attached_client_count != last_attached_client_count {
if attached_client_count == 0 && last_attached_client_count > 0 {
last_detached_at_ms = Some(crate::attention::now_ms());
}
last_att... |
rust_dataset_chunk_512781 | rust_dataset.txt | 512,781 | 512 | None => config.options.clone(),
};
let should_launch_setup_wizard =
runtime_config_options.show_setup_screen.unwrap_or(true)
&& session_may_show_setup(
is_resumed_session,
... |
rust_dataset_chunk_512782 | rust_dataset.txt | 512,782 | 512 | .current_input_modes
.insert(client_id, default_input_mode);
*session_data.write().unwrap() = Some(session);
session_state.write().unwrap().set_client_data(
client_id,
client_attributes.size,
is_web_client,... |
rust_dataset_chunk_512783 | rust_dataset.txt | 512,783 | 512 | _panes_layout = floating_panes_layout.clone();
if should_focus_tab {
if let Some(pane) = onboarding_pane.take() {
floating_panes_layout.push(pane);
}
}
spawn_ta... |
rust_dataset_chunk_512784 | rust_dataset.txt | 512,784 | 512 | pane_id_to_focus,
is_web_client,
client_id,
) => {
let mut rlock = session_data.write().unwrap();
let Some(session_data) = rlock.as_mut() else {
drop(rlock);
log::error!(
... |
rust_dataset_chunk_512785 | rust_dataset.txt | 512,785 | 512 | _data
.session_configuration
.set_client_runtime_configuration(client_id, runtime_configuration);
let default_input_mode = session_data
.session_configuration
.get_client_default_input_mode(&client_id);
sess... |
rust_dataset_chunk_512786 | rust_dataset.txt | 512,786 | 512 | (for rendering) with the terminal size
session_data
.write()
.unwrap()
.as_ref()
.unwrap()
.senders
.send_to_screen(ScreenInstruction::AddWatcherClient(
client... |
rust_dataset_chunk_512787 | rust_dataset.txt | 512,787 | 512 | CliPipeOutput {
pipe_name: pipe_name.clone(),
output: output.clone()
},
session_state,
session_data
);
... |
rust_dataset_chunk_512788 | rust_dataset.txt | 512,788 | 512 | (
watcher_id,
ServerToClientMsg::Exit {
exit_reason: ExitReason::Normal,
},
);
}
break;
}
... |
rust_dataset_chunk_512789 | rust_dataset.txt | 512,789 | 512 | .unwrap()
.client_ids()
.iter()
.copied()
.filter(|c| c != &client_id)
.collect();
for client_id in client_ids {
if let Some(session_data) = session_data.write().un... |
rust_dataset_chunk_512790 | rust_dataset.txt | 512,790 | 512 | ToClientMsg::RenderFrame { frame },
};
send_to_client!(client_id, os_input, msg, session_state, session_data);
}
} else {
// Session is exiting - disconnect all regular clients
for client_id in cl... |
rust_dataset_chunk_512791 | rust_dataset.txt | 512,791 | 512 | _data
);
},
ServerInstruction::SessionRenamed(new_name) => {
if let Err(e) =
server_socket.rename(zellij_utils::consts::session_socket_path(&new_name))
{
log::error!("Failed to rename ipc socket: {:?}", e);
... |
rust_dataset_chunk_512792 | rust_dataset.txt | 512,792 | 512 | ) => {
if let Some(session_data) = session_data.read().unwrap().as_ref() {
let _ = session_data.senders.send_to_screen(
ScreenInstruction::UpdateClientSessionHistory {
client_id,
... |
rust_dataset_chunk_512793 | rust_dataset.txt | 512,793 | 512 | session_configuration
.get_client_default_input_mode(&client_id);
session_data
.current_input_modes
.insert(client_id, input_mode);
session_data
.senders
.send_to_screen(ScreenInstruction:... |
rust_dataset_chunk_512794 | rust_dataset.txt | 512,794 | 512 | client_id,
history: merged,
},
);
}
},
ServerInstruction::TerminalSettingsChanged(client_id, settings) => {
send_to_client!(
client_id,
os_input,
... |
rust_dataset_chunk_512795 | rust_dataset.txt | 512,795 | 512 | } => {
reload_config_file(&session_data);
},
ServerInstruction::SaveKeybindsAsPreset {
client_id,
new_name,
response_channel,
} => {
let result = session_data
.read()
... |
rust_dataset_chunk_512796 | rust_dataset.txt | 512,796 | 512 | ()
.map(|session_data| {
session_data
.session_configuration
.delete_theme_file(&client_id, &name)
})
.unwrap_or_else(|| Err("No active session".to_owned()));
let r... |
rust_dataset_chunk_512797 | rust_dataset.txt | 512,797 | 512 | _before,
new_config,
write_config_to_disk,
runtime_config_changed,
&session_data,
client_id,
);
},
ServerInstruction::ResetKeys {
client_id,
keys,
... |
rust_dataset_chunk_512798 | rust_dataset.txt | 512,798 | 512 | ()
.copied()
.collect();
for client_id in web_client_ids {
let _ = os_input.send_to_client(
client_id,
ServerToClientMsg::Exit {
... |
rust_dataset_chunk_512799 | rust_dataset.txt | 512,799 | 512 | ForwardQueryToHost(token, query_bytes, resolve_async) => {
// Pick a regular (non-watcher) client to carry the
// forward. Preference is the most recently active
// client (whichever last sent input); falls back to
// any connected client. When the host te... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.