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_518200 | rust_dataset.txt | 518,200 | 512 | unning)? {
return None;
}
Some(Upgrade {
path: existing.to_path_buf(),
from: running.to_owned(),
to: running.to_owned(),
same_version: true,
})
}
pub fn entry_binary(
environment: &Environment,
destination: Option<&Path>,
state: &IntegrationState,
) -> an... |
rust_dataset_chunk_518201 | rust_dataset.txt | 518,201 | 512 | let output = std::process::Command::new(binary)
.arg("--version")
.stdin(std::process::Stdio::null())
.output()
.ok()?;
let text = String::from_utf8_lossy(&output.stdout).trim().to_owned();
(!text.is_empty()).then_some(text)
}
pub fn copy_binary(
source: &Path,
desti... |
rust_dataset_chunk_518202 | rust_dataset.txt | 518,202 | 512 | old file is
/// moved aside first and deleted as soon as nothing runs it, at the latest by the next copy.
#[cfg(windows)]
fn put_in_place(temporary: &Path, destination: &Path) -> std::io::Result<()> {
clear_set_aside(destination);
let aside = destination
.exists()
.then(|| destination.with_exte... |
rust_dataset_chunk_518203 | rust_dataset.txt | 518,203 | 512 | ::current_exe()
.map(|exe| location::same_file(&exe, &record.destination))
.unwrap_or(false)
{
anyhow::bail!(
"{} is the copy running right now, so it cannot be removed from here.",
record.destination.display()
);
}
std::fs::remove_file(&record.destina... |
rust_dataset_chunk_518204 | rust_dataset.txt | 518,204 | 512 | var_os(key).filter(|v| !v.is_empty());
if env("DISTROBOX_ENTER_PATH").is_some() || env("CONTAINER_ID").is_some() {
return Some("Distrobox".to_owned());
}
if env("TOOLBOX_PATH").is_some() {
return Some("Toolbox".to_owned());
}
if Path::new("/.flatpak-info")... |
rust_dataset_chunk_518205 | rust_dataset.txt | 518,205 | 512 | desktop was found".to_owned());
}
None
}
fn is_wsl() -> bool {
std::env::var_os("WSL_DISTRO_NAME").is_some()
|| std::fs::read_to_string("/proc/version")
.map(|v| v.to_ascii_lowercase().contains("microsoft"))
.unwrap_or(false)
}
fn ho... |
rust_dataset_chunk_518206 | rust_dataset.txt | 518,206 | 512 | }
None
}
pub fn items(environment: &Environment, state: &IntegrationState) -> Vec<ItemStatus> {
let launcher = launcher_status(environment);
let default_terminal = default_terminal_status(environment, &launcher);
vec![
copy_binary_status(environment, state),
... |
rust_dataset_chunk_518207 | rust_dataset.txt | 518,207 | 512 | !(
"Zellij was installed by {}, which did not add a launcher",
manager
),
)
.with_hint(hint)
.with_instructions(tiling_instructions());
}
owned_status(Item::Launcher, Owner::Nobody, "Not installed")
.... |
rust_dataset_chunk_518208 | rust_dataset.txt | 518,208 | 512 | Terminal) {
return hidden;
}
let Some(method) = Method::detect(environment.desktop.as_deref()) else {
return ItemStatus::unavailable(
Item::DefaultTerminal,
"Your desktop has no terminal setting Zellij can change safely",
)
... |
rust_dataset_chunk_518209 | rust_dataset.txt | 518,209 | 512 | ) -> Outcome {
let result = match item {
Item::Launcher => remove_launcher(),
Item::CopyBinary => super::remove_recorded_copy(&load()),
Item::DefaultTerminal => Err(anyhow::anyhow!(
"Zellij does not change the default terminal back"
)),
... |
rust_dataset_chunk_518210 | rust_dataset.txt | 518,210 | 512 | current_exe().context("failed to locate the running binary")?;
let destination = copy_destination().context("there is no home folder")?;
let upgrade = match super::copy_state(&super::environment(), &destination) {
super::CopyState::Update(upgrade) => Some(upgrade),
_ => None,
... |
rust_dataset_chunk_518211 | rust_dataset.txt | 518,211 | 512 | }
Ok(message)
}
fn install_default_terminal(environment: &Environment) -> Result<String> {
let method = Method::detect(environment.desktop.as_deref())
.context("your desktop has no terminal setting Zellij can change safely")?;
let binary = launcher_binary()?;
let be... |
rust_dataset_chunk_518212 | rust_dataset.txt | 518,212 | 512 | (&self) -> &'static [&'static str] {
match self {
Method::XdgTerminalsList => &["first"],
Method::Kde => &["TerminalApplication", "TerminalService"],
Method::Cinnamon | Method::Mate => &["exec", "exec-arg"],
}
}
pub fn current(&sel... |
rust_dataset_chunk_518213 | rust_dataset.txt | 518,213 | 512 | ::Kde => get("TerminalService") == location::launcher_file_name(),
Method::Cinnamon | Method::Mate => {
let exec = get("exec");
exec.ends_with(" terminal")
&& exec
.trim_end_matches(" terminal")
... |
rust_dataset_chunk_518214 | rust_dataset.txt | 518,214 | 512 | (format!(
"{}-xdg-terminals.list",
desktop.to_ascii_lowercase()
));
if std::fs::read_to_string(&specific)
.ok()
.and_then(|text| first_terminal(&text))
.is_some()
{
return Some(specific);
... |
rust_dataset_chunk_518215 | rust_dataset.txt | 518,215 | 512 | = (start + 1..end).find(|i| {
lines[*i]
.split_once('=')
.map(|(k, _)| k.trim() == key)
.unwrap_or(false)
});
match (existing, value) {
(Some(i), Some(value)) => lines[i] = format!("{}={}", key, value),
(Some(i), None) ... |
rust_dataset_chunk_518216 | rust_dataset.txt | 518,216 | 512 | ::from_utf8_lossy(&output.stdout).trim().to_owned();
let unquoted = text
.strip_prefix('\'')
.and_then(|t| t.strip_suffix('\''))
.map(|t| t.replace("\\'", "'").replace("\\\\", "\\"))
.unwrap_or(text);
(!unquoted.is_empty()).then_some(unquoted)
}
f... |
rust_dataset_chunk_518217 | rust_dataset.txt | 518,217 | 512 | General", "TerminalApplication"), None);
assert_eq!(
ini_get(&removed, "General", "font").as_deref(),
Some("Noto")
);
let fresh = ini_set(
"",
"General",
"TerminalService",
Some("dev.zelli... |
rust_dataset_chunk_518218 | rust_dataset.txt | 518,218 | 512 | com::{known_folder, Com};
use crate::desktop_integration::desktop_entry::start_menu;
use crate::desktop_integration::terminal_command::terminal_command;
const EXPLORER_KEYS: [&str; 3] = [
r"Software\Classes\Directory\shell\Zellij",
r"Software\Classes\Directory\Background\shell\Zellij",
... |
rust_dataset_chunk_518219 | rust_dataset.txt | 518,219 | 512 | (root, ZELLIJ_KEY, name) == Some(1))
}
/// The folder the installer uses for a per-user install, where earlier Zellij versions and
/// their files already are.
fn copy_folder() -> Result<PathBuf> {
Ok(known_folder(&FOLDERID_LocalAppData)?.join("Zellij"))
}
/// The installer put a Zelli... |
rust_dataset_chunk_518220 | rust_dataset.txt | 518,220 | 512 | shadow {
Some(note) => format!("{} {}", text, note),
None => text,
};
if let Some(destination) = &target {
let copy_state = super::copy_state(environment, destination);
if !matches!(copy_state, super::CopyState::Permanent(_)) && installer_owns(destination)... |
rust_dataset_chunk_518221 | rust_dataset.txt | 518,221 | 512 | format!(" ({})", version))
.unwrap_or_default();
Some(format!(
"{}{} comes first on your PATH, so typing {} in a terminal runs that one.",
first.display(),
version,
name
))
}
fn start_menu_status(state: &IntegrationState) -> ItemStatu... |
rust_dataset_chunk_518222 | rust_dataset.txt | 518,222 | 512 | <RepairOffer> {
None
}
pub fn install(item: Item, _environment: &Environment, overwrite_binary: bool) -> Outcome {
let result = match item {
Item::CopyBinary => install_copy(overwrite_binary),
Item::StartMenu => install_start_menu(),
Item::ExplorerItem => ins... |
rust_dataset_chunk_518223 | rust_dataset.txt | 518,223 | 512 | update(|state: &mut IntegrationState| state.windows.jump_list = false);
"Removed the taskbar jump list".to_owned()
},
Err(e) => format!("failed to remove the taskbar jump list: {:#}", e),
});
}
lines
}
fn delete_jump_list() -> Res... |
rust_dataset_chunk_518224 | rust_dataset.txt | 518,224 | 512 | !("Wrote {}", folder.join(launcher_name).display()));
}
let Some(fingerprint) = copy_binary(&source, &destination, overwrite)? else {
return Ok(format!("{} is this copy already", destination.display()));
};
lines.push(format!("Wrote {}", destination.display()));
let r... |
rust_dataset_chunk_518225 | rust_dataset.txt | 518,225 | 512 | was
/// added, as opposed to there already.
fn add_to_user_path(folder: &Path) -> Result<bool> {
use windows_sys::Win32::System::Registry::REG_EXPAND_SZ;
let (value, kind) =
registry::get_raw_text(registry::Root::CurrentUser, ENVIRONMENT_KEY, "Path")
.unwrap_or_else(... |
rust_dataset_chunk_518226 | rust_dataset.txt | 518,226 | 512 | , folder)
})
}
/// The PATH without `folder`, or nothing when it is not there.
fn path_without(value: &str, folder: &str) -> Option<String> {
let entries: Vec<&str> = value.split(';').collect();
let kept: Vec<&str> = entries
.iter()
.copied()
.fil... |
rust_dataset_chunk_518227 | rust_dataset.txt | 518,227 | 512 | = terminal_command(&exe);
if !launcher.uses_launcher() {
bail!(
"zellij-terminal.exe was not found next to {}, so Explorer would open a console \
window alongside Zellij",
exe.display()
);
}
let program = launcher.program.... |
rust_dataset_chunk_518228 | rust_dataset.txt | 518,228 | 512 | (super) fn wide(text: &str) -> Vec<u16> {
text.encode_utf16().chain(std::iter::once(0)).collect()
}
pub fn key_exists(at: Root, key: &str) -> bool {
let mut handle: HKEY = std::ptr::null_mut();
let opened =
unsafe { RegOpenKeyExW(root(at), wide(key).a... |
rust_dataset_chunk_518229 | rust_dataset.txt | 518,229 | 512 | ).unwrap_or(buffer.len());
Some((String::from_utf16_lossy(&buffer[..end]), kind))
}
pub fn get_dword(at: Root, key: &str, name: &str) -> Option<u32> {
let mut value: u32 = 0;
let mut size: u32 = std::mem::size_of::<u32>() as u32;
let read = unsafe {
... |
rust_dataset_chunk_518230 | rust_dataset.txt | 518,230 | 512 | ()) };
match result {
ERROR_SUCCESS | ERROR_FILE_NOT_FOUND => Ok(()),
error => bail!("failed to remove {} (error {})", key, error),
}
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn the_copy_folder_is_added_at_th... |
rust_dataset_chunk_518231 | rust_dataset.txt | 518,231 | 512 | &str| {
(key == "SSH_CONNECTION")
.then(|| std::ffi::OsString::from("10.0.0.2 5 10.0.0.1 22"))
};
assert!(over_ssh(from_ssh));
assert!(!over_ssh(|_| None));
assert!(!over_ssh(|_| Some(std::ffi::OsString::new())));
}
}
}
#[... |
rust_dataset_chunk_518232 | rust_dataset.txt | 518,232 | 512 | copy_destination() {
Some(destination) => copy_binary_status(environment, &destination),
None => ItemStatus::unavailable(Item::CopyBinary, "There is no home folder"),
};
let app = match (macos_bundle::applications_dir(), running(environment)) {
(Ok(applications), Som... |
rust_dataset_chunk_518233 | rust_dataset.txt | 518,233 | 512 | let base = ItemStatus {
available: true,
changeable: true,
owner: Owner::Zellij,
..ItemStatus::unavailable(Item::Launcher, "")
}
.with_display_name(name.clone())
.with_target(bundle.to_path_buf());
if macos_bundle::is_inside_a_bundl... |
rust_dataset_chunk_518234 | rust_dataset.txt | 518,234 | 512 | of Zellij inside {}",
running.display(),
macos_bundle::bundle_name()
),
)
.with_hint(format!(
"To put zellij on your PATH, run zellij setup --copy-to-permanent-folder \
from the zellij you made {} from",
... |
rust_dataset_chunk_518235 | rust_dataset.txt | 518,235 | 512 | Environment, overwrite: bool) -> Outcome {
let result = match item {
Item::Launcher => install_app(environment),
Item::CopyBinary => install_copy(environment, overwrite),
other => Err(anyhow::anyhow!(other_item(other).state_text)),
};
outcome(item, true, resul... |
rust_dataset_chunk_518236 | rust_dataset.txt | 518,236 | 512 | "\n{} is not on your PATH yet; add it to run `zellij` from a terminal",
dir.display()
));
}
}
Ok(message)
}
/// Like `copy_binary`, but keeps the source's mtime, so the app sees both files as the
/// same build.
pub(super) fn copy_keeping... |
rust_dataset_chunk_518237 | rust_dataset.txt | 518,237 | 512 | UNDLE: &str = "/Users/me/Applications/Zellij.app";
const RUNNING: &str = "/opt/homebrew/bin/zellij";
fn status(
installed: Option<Installed>,
version: &str,
len: u64,
inside: bool,
) -> ItemStatus {
status_of_build(installed, version, ... |
rust_dataset_chunk_518238 | rust_dataset.txt | 518,238 | 512 | s.installed);
assert_eq!(s.owner, Owner::Zellij);
assert_eq!(s.upgrade, None);
assert_eq!(s.removes, vec![BUNDLE.to_owned()]);
}
#[test]
fn another_version_offers_an_update() {
let s = status(at("0.45.1", 10), "0.46.0", 10, false);
as... |
rust_dataset_chunk_518239 | rust_dataset.txt | 518,239 | 512 | (!s.available && !s.changeable, "{:?}", s);
assert_eq!(s.state_text, "Not available over SSH");
}
#[test]
fn an_ssh_session_has_no_desktop() {
let only = |name: &'static str| {
move |key: &str| (key == name).then(|| std::ffi::OsString::from("x"))
... |
rust_dataset_chunk_518240 | rust_dataset.txt | 518,240 | 512 | _eq!(s.target.as_deref(), Some(destination.as_path()));
assert!(
s.state_text
.contains(&format!("It would be copied to {}", destination.display())),
"{}",
s.state_text
);
assert!(
s.state_text.contai... |
rust_dataset_chunk_518241 | rust_dataset.txt | 518,241 | 512 | ();
let running = dir.path().join("zellij");
let copy = dir.path().join("bin").join("zellij");
std::fs::write(&running, b"zellij").unwrap();
std::thread::sleep(std::time::Duration::from_millis(20));
copy_keeping_build(&running, ©, false).unwrap();
... |
rust_dataset_chunk_518242 | rust_dataset.txt | 518,242 | 512 | finish.", BUNDLE)
);
assert_eq!(removed_message(None), "Nothing written by Zellij was found");
}
}
}
#[cfg(not(any(
windows,
target_os = "macos",
all(unix, not(target_os = "macos"), not(target_os = "android"))
)))]
mod unsupported {
use crate::desktop_integration::{... |
rust_dataset_chunk_518243 | rust_dataset.txt | 518,243 | 512 | ered_as_a_replacement_build() {
let path = Path::new("/home/someone/.local/bin/zellij");
assert!(same_version_offer(path, "zellij 0.45.0", "0.46.0").is_none());
assert!(same_version_offer(path, "zellij 0.47.0", "0.46.0").is_none());
}
#[test]
fn items_are_installed_in_dependency_ord... |
rust_dataset_chunk_518244 | rust_dataset.txt | 518,244 | 512 | let _ = self.0.kill();
let _ = self.0.wait();
}
}
let dir = tempfile::TempDir::new().unwrap();
let destination = dir.path().join("zellij.exe");
let system = PathBuf::from(std::env::var_os("SystemRoot").unwrap()).join("System32");
std::f... |
rust_dataset_chunk_518245 | rust_dataset.txt | 518,245 | 512 | Path) -> TerminalCommand {
let launcher = launcher_of(exe);
let launcher_exists = launcher.is_file();
command_for(exe, launcher, launcher_exists)
}
fn launcher_of(exe: &Path) -> PathBuf {
let stem = exe
.file_stem()
.map(|stem| stem.to_string_lossy().into_owned())
.unwrap_or_def... |
rust_dataset_chunk_518246 | rust_dataset.txt | 518,246 | 512 | \zellij.exe" terminal"#
);
}
#[test]
fn without_a_launcher_the_window_verb_is_run_directly() {
let exe = Path::new("install").join("zellij.exe");
let command = command_for(&exe, launcher_of(&exe), false);
assert_eq!(
command,
TerminalCommand {
... |
rust_dataset_chunk_518247 | rust_dataset.txt | 518,247 | 512 | Option<&'static str>,
}
impl DistributionLayout {
pub fn new(name: &'static str, layout: &'static str) -> Self {
DistributionLayout {
name,
layout,
swap_layout: None,
}
}
pub fn with_swap_layout(mut self, swap_layout: &'static str) -> Self {
self... |
rust_dataset_chunk_518248 | rust_dataset.txt | 518,248 | 512 | _plugins: vec![],
config: None,
layouts: vec![],
keybind_presets: vec![],
is_stock_zellij: false,
}
}
pub fn with_display_name(mut self, display_name: &'static str) -> Self {
self.display_name = display_name;
self
}
pub fn with_app_... |
rust_dataset_chunk_518249 | rust_dataset.txt | 518,249 | 512 | }
pub fn with_layout(mut self, layout: DistributionLayout) -> Self {
self.layouts.push(layout);
self
}
pub fn with_keybind_preset(mut self, preset: DistributionKeybindPreset) -> Self {
self.keybind_presets.push(preset);
self
}
/// Stock Zellij, with its own builtin p... |
rust_dataset_chunk_518250 | rust_dataset.txt | 518,250 | 512 | "session-manager",
"configuration",
"plugin-manager",
"about",
"share",
"multiple-select",
"layout-manager",
"prompt",
"context-menu",
];
// Plugins are taken from:
//
// - `zellij-utils/assets/plugins`: When building in release mode OR when the
// `plugins_from_target` feature IS... |
rust_dataset_chunk_518251 | rust_dataset.txt | 518,251 | 512 | PluginNameCollidesWithBuiltin(String),
DuplicatePluginName(String),
DuplicateLayoutName(String),
DuplicateKeybindPresetName(String),
UnknownBuiltinPlugin(String),
}
impl std::fmt::Display for DistributionError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match ... |
rust_dataset_chunk_518252 | rust_dataset.txt | 518,252 | 512 | -> Result<(), DistributionError> {
distribution.plugins = resolve_plugins(zellij_builtin_plugins(), &distribution)?;
DISTRIBUTION
.set(distribution)
.map_err(|_| DistributionError::AlreadySet)
}
/// Validate a distribution and compute its effective plugin set: `builtins`, minus the builtins
//... |
rust_dataset_chunk_518253 | rust_dataset.txt | 518,253 | 512 | .is_ascii_digit() || c == '-' || c == '_')
}
/// The distribution this process is running, defaulting to stock Zellij
pub fn distribution() -> &'static Distribution {
DISTRIBUTION.get_or_init(Distribution::zellij)
}
/// Whether the given name refers to a plugin bundled into this executable, and may therefore be
/... |
rust_dataset_chunk_518254 | rust_dataset.txt | 518,254 | 512 | removed_builtin_plugin_names() -> Vec<&'static str> {
let distribution = distribution();
distribution
.removed_builtin_plugins
.iter()
.copied()
.filter(|name| distribution.plugin(name).is_none())
.collect()
}
/// The lowercase identifier every path and the command name... |
rust_dataset_chunk_518255 | rust_dataset.txt | 518,255 | 512 | () {
let distribution = Distribution::new("test", "0.0.0").with_plugin("sidebar", b"sidebar");
assert_eq!(
resolved_names(&distribution),
vec!["sidebar", "status-bar", "strider", "tab-bar"]
);
}
#[test]
fn a_distribution_can_remove_a_builtin() {
let d... |
rust_dataset_chunk_518256 | rust_dataset.txt | 518,256 | 512 | 0.0.0")
.without_plugin("tab-bar")
.with_plugin("tab-bar", b"replacement");
assert_eq!(resolved_names(&after), resolved_names(&before));
}
#[test]
fn distribution_plugin_may_not_shadow_a_builtin() {
let distribution = Distribution::new("test", "0.0.0").with_plugin("t... |
rust_dataset_chunk_518257 | rust_dataset.txt | 518,257 | 512 | Error::UnknownBuiltinPlugin(
"not-a-plugin".to_owned()
))
);
}
#[test]
fn distribution_name_must_be_usable_as_a_directory_name() {
for name in ["", "Yazelix", "my distribution", "dist/ro", "diström"] {
assert_eq!(
resolve_plugins(fake_... |
rust_dataset_chunk_518258 | rust_dataset.txt | 518,258 | 512 | Ext as _, sync::Mutex};
use tokio_stream::StreamExt as _;
use tokio_util::compat::FuturesAsyncReadCompatExt as _;
use tokio_util::io::ReaderStream;
use url::Url;
const STREAM_BUFFER_SIZE_BYTES: usize = 65535;
#[derive(Error, Debug)]
pub enum DownloaderError {
#[error("RequestError: {0}")]
Request(#[from] isah... |
rust_dataset_chunk_518259 | rust_dataset.txt | 518,259 | 512 | (());
};
let file_name = match file_name {
Some(name) => name.to_string(),
None => self.parse_name(url)?,
};
// we do this to make sure only one download of a specific url is happening at a time
// otherwise the downloads corrupt each other (and we waste ... |
rust_dataset_chunk_518260 | rust_dataset.txt | 518,260 | 512 | _part_path);
tokio::fs::rename(file_part_path, file_path)
.await
.map_err(|e| DownloaderError::Io(e))?;
Ok(())
}
pub async fn download_without_cache(url: &str) -> Result<String, DownloaderError> {
let request = Request::get(url)
.header("Content-Type... |
rust_dataset_chunk_518261 | rust_dataset.txt | 518,261 | 512 | tokio::runtime::Handle::try_current() {
Ok(handle) => handle.clone(),
Err(e) if e.is_missing_context() => {
let runtime = tokio::runtime::Builder::new_current_thread()
.thread_name("ephemeral runtime for downloader implementation")
.build(... |
rust_dataset_chunk_518262 | rust_dataset.txt | 518,262 | 512 | ("Failed to create temp directory");
let location_path = location.path();
let downloader = Downloader::new(location_path.to_path_buf());
let result = downloader
.download(
"https://github.com/imsnif/multitask/releases/download/0.38.2v2/multitask.wasm",
... |
rust_dataset_chunk_518263 | rust_dataset.txt | 518,263 | 512 |
}
pub fn get_socket_dir() -> Result<String> {
Ok(var(SOCKET_DIR_ENV_KEY)?)
}
/// Manage ENVIRONMENT VARIABLES from the configuration and the layout files
#[derive(Default, Clone, PartialEq, Serialize, Deserialize)]
pub struct EnvironmentVariables {
env: HashMap<String, String>,
}
impl fmt::Debug for Environm... |
rust_dataset_chunk_518264 | rust_dataset.txt | 518,264 | 512 | remove_var(had_none);
let mut data = HashMap::new();
data.insert(had_a_value.to_owned(), "from the config".to_owned());
data.insert(had_none.to_owned(), "also from the config".to_owned());
EnvironmentVariables::from_data(data.clone()).set_vars();
EnvironmentVariables::from_data(d... |
rust_dataset_chunk_518265 | rust_dataset.txt | 518,265 | 512 | anyError;
pub use anyhow::Result;
}
pub trait ErrorInstruction {
fn error(err: String) -> Self;
}
/// Helper trait to easily log error types.
///
/// The `print_error` function takes a closure which takes a `&str` and fares with it as necessary
/// to log the error to some usable location. For convenience, l... |
rust_dataset_chunk_518266 | rust_dataset.txt | 518,266 | 512 | !()` macro, which is replaced at
// compile time in the location it is written!
log::logger().log(
&log::Record::builder()
.level(log::Level::Error)
.args(format_args!("{}", msg))
.file(Some(caller.file()))
... |
rust_dataset_chunk_518267 | rust_dataset.txt | 518,267 | 512 | (unused_must_use)]` cargo warnings. Used exclusively in
/// `FatalError::non_fatal`!
fn discard_result<T>(_arg: anyhow::Result<T>) {}
impl<T> FatalError<T> for anyhow::Result<T> {
fn non_fatal(self) {
if self.is_err() {
discard_result(self.context("a non-fatal error occurred").to_log());
... |
rust_dataset_chunk_518268 | rust_dataset.txt | 518,268 | 512 | "AsyncTask".to_string())),
ContextType::PtyWrite(c) => Some(("pty_writer_thread:", format!("{:?}", c))),
ContextType::BackgroundJob(c) => Some(("background_jobs_thread:", format!("{:?}", c))),
ContextType::Empty => None,
} {
write!(f, "{} {}", left.purple(), righ... |
rust_dataset_chunk_518269 | rust_dataset.txt | 518,269 | 512 | HalfPageScrollDown,
ClearScroll,
CloseFocusedPane,
ToggleActiveSyncTab,
ToggleActiveTerminalFullscreen,
ToggleActiveTerminalNoUiFullscreen,
TogglePaneFrames,
ToggleStackListOrientation,
ToggleStackListOrientationWithPaneId,
SetPaneFrameStyle,
SetSelectable,
ShowPluginCursor,... |
rust_dataset_chunk_518270 | rust_dataset.txt | 518,270 | 512 | StartOrReloadPluginPane,
NewFloatingPluginPane,
AddPlugin,
UpdatePluginLoadingStage,
ProgressPluginLoadingOffset,
StartPluginLoadingIndication,
RequestStateUpdateForPlugins,
LaunchOrFocusPlugin,
LaunchPlugin,
SuppressPane,
UnsuppressPane,
UnsuppressOrExpandPane,
Focus... |
rust_dataset_chunk_518271 | rust_dataset.txt | 518,271 | 512 | Exit,
SetPopupFocused,
PopupToFloatingPane,
ShowSwapLayoutNotification,
SetSwapLayoutNotification,
ToggleBars,
HideBars,
ShowBars,
HideBarByPaneId,
SetHiddenBarsNotification,
SetModeHintsWhenBarsHidden,
SetGraphemeClusters,
GetSessionPreview,
GetSessionAttention,
... |
rust_dataset_chunk_518272 | rust_dataset.txt | 518,272 | 512 | Id,
MoveTabWithTabId,
MoveTabToPosition,
UpdateBackgroundPluginSubscriptions,
ClearHintTextCache,
BroadcastModeUpdate,
SetSoftKeyboard,
FocusHostSession,
FocusGuestSession,
ToggleHostFullscreen,
AttentionIdleCheck,
AttentionForegroundChanged,
MutePane,
IgnorePaneOutpu... |
rust_dataset_chunk_518273 | rust_dataset.txt | 518,273 | 512 | ,
CachePluginEvents,
MessageFromPlugin,
UnblockCliPipes,
WatchFilesystem,
KeybindPipe,
DumpLayoutToPlugin,
ListClientsMetadata,
Reconfigure,
FailedToWriteConfigToDisk,
ConfigWasWrittenToDisk,
ConfigChangesDropped,
ConfigFileChangedSinceRead,
ListClientsToPlugin,
C... |
rust_dataset_chunk_518274 | rust_dataset.txt | 518,274 | 512 | Keys,
ResetMousebinds,
ReadConfig,
RevertConfig,
UnsetConfigSetting,
SaveConfig,
OverwriteConfigFile,
ReloadConfigFile,
CopyKeybindPreset,
SaveKeybindsAsPreset,
WriteThemeFile,
DeleteThemeFile,
StartWebServer,
ShareCurrentSession,
StopSharingCurrentSession,
We... |
rust_dataset_chunk_518275 | rust_dataset.txt | 518,275 | 512 | Plugin directory: '{plugin_dir}'
If you're a user:
Please report this error to the distributor of your current zellij version
If you're a developer:
Either make sure to include the plugins with the application (See feature
'disable_automatic_asset_installation'), or make them available in the
plugin ... |
rust_dataset_chunk_518276 | rust_dataset.txt | 518,276 | 512 | #[cfg(not(target_family = "wasm"))]
mod not_wasm {
use super::*;
use crate::channels::{SenderWithContext, ASYNCOPENCALLS, OPENCALLS};
use miette::{Diagnostic, GraphicalReportHandler, GraphicalTheme, Report};
use std::panic::PanicHookInfo;
use thiserror::Error as ThisError;
/// The maximum amoun... |
rust_dataset_chunk_518277 | rust_dataset.txt | 518,277 | 512 | /issues
",
crate::consts::ZELLIJ_TMP_LOG_FILE.display().to_string()
)
}
}
/// Custom panic handler/hook. Prints the [`ErrorContext`].
pub fn handle_panic<T>(info: &PanicHookInfo<'_>, sender: Option<&SenderWithContext<T>>)
where
T: ErrorInstruction + Clone,
... |
rust_dataset_chunk_518278 | rust_dataset.txt | 518,278 | 512 | (|ctx| *ctx.borrow())
.unwrap_or_else(|_| OPENCALLS.with(|ctx| *ctx.borrow()))
}
fn fmt_report(diag: Report) -> String {
let mut out = String::new();
GraphicalReportHandler::new_themed(GraphicalTheme::unicode())
.render_report(&mut out, diag.as_ref())
.unwrap... |
rust_dataset_chunk_518279 | rust_dataset.txt | 518,279 | 512 | error types that don't satisfy `anyhow`s trait requirements to
/// anyhow errors.
pub trait ToAnyhow<U> {
fn to_anyhow(self) -> anyhow::Result<U>;
}
/// `SendError` doesn't satisfy `anyhow`s trait requirements due to `T` possibly being a
/// `PluginInstruction` type, which wraps an `mpsc::... |
rust_dataset_chunk_518280 | rust_dataset.txt | 518,280 | 512 | str) -> impl Iterator<Item = (&str, usize)> {
s.graphemes(true)
.map(|cluster| (cluster, cluster_width(cluster)))
}
pub fn cluster_width(cluster: &str) -> usize {
if cluster.is_ascii() {
cluster.bytes().filter(|b| !b.is_ascii_control()).count()
} else {
cluster.width()
}
}
pub ... |
rust_dataset_chunk_518281 | rust_dataset.txt | 518,281 | 512 | (format!("{}{}", head, ellipsis))
},
None => Cow::Borrowed(prefix_within(s, max_cols).0),
}
}
pub fn truncate_start<'a>(s: &'a str, max_cols: usize, marker: &str) -> Cow<'a, str> {
if display_width(s) <= max_cols {
return Cow::Borrowed(s);
}
match ellipsis_fits(max_cols, marker)... |
rust_dataset_chunk_518282 | rust_dataset.txt | 518,282 | 512 | .push((seen_chars, seen_chars + count));
seen_chars += count;
}
ranges
}
pub fn previous_cluster_start(s: &str, byte_offset: usize) -> usize {
let mut previous = 0;
for (index, _) in s.grapheme_indices(true) {
if index >= byte_offset {
break;
}
previous = ind... |
rust_dataset_chunk_518283 | rust_dataset.txt | 518,283 | 512 | uses that, else returns a
/// dir matching the config spec.
pub fn get_default_data_dir() -> PathBuf {
[xdg_data_dir(), platform::system_data_dir()]
.into_iter()
.find(|p| p.exists())
.unwrap_or_else(xdg_data_dir)
}
pub fn xdg_config_dir() -> PathBuf {
ZELLIJ_PROJ_DIR.config_dir().to_o... |
rust_dataset_chunk_518284 | rust_dataset.txt | 518,284 | 512 | }
}
}
/// System-wide data directory (e.g. `/usr/share/zellij` from distro packages).
pub(crate) fn system_data_dir() -> PathBuf {
use crate::consts::SYSTEM_DEFAULT_DATA_DIR_PREFIX;
std::path::Path::new(SYSTEM_DEFAULT_DATA_DIR_PREFIX)
.join("share")
.join(crate::distribution::name()... |
rust_dataset_chunk_518285 | rust_dataset.txt | 518,285 | 512 | Buf;
use std::str::FromStr;
use crate::position::Position;
pub fn initial_panes_from_cli(
initial_command: Vec<String>,
initial_plugin: Option<String>,
cwd: Option<PathBuf>,
caller_cwd: PathBuf,
close_on_exit: bool,
start_suspended: bool,
) -> Option<Vec<CommandOrPlugin>> {
if let Some(plu... |
rust_dataset_chunk_518286 | rust_dataset.txt | 518,286 | 512 | down" => Ok(ResizeDirection::Down),
"Increase" | "increase" | "+" => Ok(ResizeDirection::Increase),
"Decrease" | "decrease" | "-" => Ok(ResizeDirection::Decrease),
_ => Err(format!(
"Failed to parse ResizeDirection. Unknown ResizeDirection: {}",
s
... |
rust_dataset_chunk_518287 | rust_dataset.txt | 518,287 | 512 | <u8>,
is_kitty_keyboard_protocol: bool,
},
/// Write Characters to the terminal.
WriteChars {
chars: String,
},
/// Write to a specific pane by ID.
WriteToPaneId {
bytes: Vec<u8>,
pane_id: PaneId,
},
/// Write Characters to a specific pane by ID.
Write... |
rust_dataset_chunk_518288 | rust_dataset.txt | 518,288 | 512 | Position,
CopyLastCommandOutput,
/// Scroll down to bottom in focus pane.
ScrollToBottom,
/// Scroll up to top in focus pane.
ScrollToTop,
/// Scroll up one page in focus pane.
PageScrollUp,
/// Scroll down one page in focus pane.
PageScrollDown,
/// Scroll up half page in focus ... |
rust_dataset_chunk_518289 | rust_dataset.txt | 518,289 | 512 | coordinates: Option<FloatingPaneCoordinates>,
near_current_pane: bool,
no_focus: bool,
tab_id: Option<usize>,
},
/// Open a new tiled (embedded, non-floating) pane
/// Returns: Created pane ID (format: terminal_<id> or plugin_<id>)
NewTiledPane {
direction: Option... |
rust_dataset_chunk_518290 | rust_dataset.txt | 518,290 | 512 | PaneLayout>,
floating_layouts: Vec<FloatingPaneLayout>,
swap_tiled_layouts: Option<Vec<SwapTiledLayout>>,
swap_floating_layouts: Option<Vec<SwapFloatingLayout>>,
tab_name: Option<String>,
should_change_focus_to_new_tab: bool,
cwd: Option<PathBuf>,
initial_panes: O... |
rust_dataset_chunk_518291 | rust_dataset.txt | 518,291 | 512 | bool,
move_to_focused_tab: bool,
should_open_in_place: bool,
close_replaced_pane: bool,
skip_cache: bool,
tab_id: Option<usize>,
},
/// Returns: Plugin pane ID (format: plugin_<id>)
LaunchPlugin {
plugin: RunPluginOrAlias,
should_float: bool,
... |
rust_dataset_chunk_518292 | rust_dataset.txt | 518,292 | 512 | plugin: RunPluginOrAlias,
pane_name: Option<String>,
skip_cache: bool,
close_replaced_pane: bool,
no_focus: bool,
tab_id: Option<usize>,
},
StartOrReloadPlugin {
plugin: RunPluginOrAlias,
},
CloseTerminalPane {
pane_id: u32,
},
ClosePlugin... |
rust_dataset_chunk_518293 | rust_dataset.txt | 518,293 | 512 | >>,
launch_new: bool,
skip_cache: bool,
floating: Option<bool>,
in_place: Option<bool>,
cwd: Option<PathBuf>,
pane_title: Option<String>,
},
ListClients,
ListPanes {
show_tab: bool,
show_command: bool,
show_state: bool,
show_geo... |
rust_dataset_chunk_518294 | rust_dataset.txt | 518,294 | 512 | bool,
},
ToggleFocusFullscreenByPaneId {
pane_id: PaneId,
},
ToggleFocusNoUiFullscreenByPaneId {
pane_id: PaneId,
},
TogglePaneEmbedOrFloatingByPaneId {
pane_id: PaneId,
},
CloseFocusByPaneId {
pane_id: PaneId,
},
RenamePaneByPaneId {
pane... |
rust_dataset_chunk_518295 | rust_dataset.txt | 518,295 | 512 | OpenSessionInTerminal,
PasteFromClipboardByPaneId {
pane_id: PaneId,
},
WaitForPaneExit {
pane_id: PaneId,
},
MarkPaneSeen {
session: Option<String>,
pane_id: Option<PaneId>,
},
MarkAllSeen {
session: Option<String>,
this_session: bool,
... |
rust_dataset_chunk_518296 | rust_dataset.txt | 518,296 | 512 | Action::TogglePaneEmbedOrFloatingByPaneId { .. } => {
vec![Action::TogglePaneEmbedOrFloating]
},
Action::CloseFocusByPaneId { .. } => vec![Action::CloseFocus],
Action::TogglePanePinnedByPaneId { .. } => vec![Action::TogglePanePinned],
Action::M... |
rust_dataset_chunk_518297 | rust_dataset.txt | 518,297 | 512 | , .. } => vec![Action::MovePane {
direction: *direction,
}],
Action::MovePaneBackwardsByPaneId { .. } => vec![Action::MovePaneBackwards],
Action::ClearScreenByPaneId { .. } => vec![Action::ClearScreen],
Action::EditScrollbackByPaneId { ansi, .. } => {
... |
rust_dataset_chunk_518298 | rust_dataset.txt | 518,298 | 512 | _current_dir: Box<dyn Fn() -> PathBuf>,
config: Option<Config>,
) -> Result<Vec<Action>, String> {
match cli_action {
CliAction::Write { bytes, pane_id } => match pane_id {
Some(pane_id_str) => {
let parsed_pane_id = PaneId::from_str(&pane_id_str);
... |
rust_dataset_chunk_518299 | rust_dataset.txt | 518,299 | 512 | a plugin pane id (eg. plugin_1)",
pane_id_str
))
}
}
},
None => Ok(vec![Action::Paste {
chars,
pane_id: None,
}]),
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.