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_514900 | rust_dataset.txt | 514,900 | 512 | _message(format!(
"Floating swap layout not found or incompatible: {layout_name}"
));
}
}
} else {
log::error!("Tab with id {} not found", tab_id);
if let Some(... |
rust_dataset_chunk_514901 | rust_dataset.txt | 514,901 | 512 | ToggleHostFullscreen(client_id, _completion_tx) => {
screen.own_fullscreen_requested = !screen.own_fullscreen_requested;
let fullscreen = screen.own_fullscreen_requested;
let payload =
nested_session::encode_payload(&NestedSessionMessage::ToggleHostFul... |
rust_dataset_chunk_514902 | rust_dataset.txt | 514,902 | 512 | non_fatal();
},
ScreenInstruction::AttentionCommandPaneStarted(pane_id, command) => {
if let PaneId::Terminal(terminal_id) = pane_id {
screen.attention_command_pane_started(terminal_id, command);
}
},
ScreenInstruction::... |
rust_dataset_chunk_514903 | rust_dataset.txt | 514,903 | 512 | "Tab #1")],
vec![pane(1, 0, "a")],
vec![client(1, 0, 1, "normal")],
);
assert!(diff_snapshots(&s, &s).is_empty());
}
#[test]
fn new_tab_with_pane_and_focus_move() {
let prev = snapshot(
vec![tab(0, 0, "Tab #1")],
vec![pane(1, 0, "a")],
vec![client(1, 0, 1, "normal")... |
rust_dataset_chunk_514904 | rust_dataset.txt | 514,904 | 512 | ![],
);
let events = diff_snapshots(&prev, &next);
assert_eq!(
events,
vec![
CliEvent::PaneClosed {
pane_id: PaneId::Terminal(2),
tab_id: Some(1),
},
CliEvent::TabClosed {
tab_id: 1,
name: "tw... |
rust_dataset_chunk_514905 | rust_dataset.txt | 514,905 | 512 | PaneFloatingChanged {
pane_id: PaneId::Terminal(1),
tab_id: 1,
is_floating: true,
},
CliEvent::PaneFullscreenChanged {
pane_id: PaneId::Terminal(1),
tab_id: 1,
is_fullscreen: true,
},
... |
rust_dataset_chunk_514906 | rust_dataset.txt | 514,906 | 512 | []);
let mut next = prev.clone();
next.session_name = "renamed".to_owned();
assert_eq!(
diff_snapshots(&prev, &next),
vec![CliEvent::SessionRenamed {
name: "renamed".to_owned(),
previous_name: "session".to_owned(),
}]
);
}
--- FILE: zellij/zellij-server/... |
rust_dataset_chunk_514907 | rust_dataset.txt | 514,907 | 512 | 5, now), Some((1, size(40, 10))));
}
#[test]
fn a_mirror_pins_while_shown_even_without_focus_unless_it_may_not_resize() {
let (mut mirrors, _receivers) = mirrors_with(&[(1, 5, false)]);
let now = Instant::now();
mirrors.update_wish(1, size(40, 10), false, true, now);
assert_eq!(winner_of(&mirrors, 5, n... |
rust_dataset_chunk_514908 | rust_dataset.txt | 514,908 | 512 | );
assert_eq!(winner_of(&mirrors, 5, now), Some((1, size(41, 10))));
mirrors.update_wish(1, size(41, 10), true, false, now);
assert_eq!(winner_of(&mirrors, 5, now), None);
}
#[test]
fn focusing_again_makes_a_mirror_the_most_recent() {
let (mut mirrors, _receivers) = mirrors_with(&[(1, 5, false), (2, 5,... |
rust_dataset_chunk_514909 | rust_dataset.txt | 514,909 | 512 | , 5, false)]);
let now = Instant::now();
let lease = mirror_pin_lease();
mirrors.update_wish(1, size(40, 10), true, true, now);
mirrors.update_wish(2, size(50, 12), true, true, now + lease / 2);
assert_eq!(mirrors.next_lease_expiry(now), Some(now + lease));
assert_eq!(
winner_of(&mirrors... |
rust_dataset_chunk_514910 | rust_dataset.txt | 514,910 | 512 | 5, later), Some((1, size(40, 10))));
}
#[test]
fn viewer_sizes_are_clamped_when_stored() {
let (mut mirrors, _receivers) = mirrors_with(&[(1, 5, false)]);
let now = Instant::now();
mirrors.update_wish(1, size(0, 100_000), true, true, now);
assert_eq!(
winner_of(&mirrors, 5, now),
Some((... |
rust_dataset_chunk_514911 | rust_dataset.txt | 514,911 | 512 | (PaneId::Terminal(5), Some(size(40, 10))),
(PaneId::Terminal(5), None)
]
);
assert_eq!(host.program_size(PaneId::Terminal(5)), Some(size(120, 40)));
assert_eq!(mirrors.next_lease_expiry(now), None);
}
#[test]
fn a_dead_viewer_hands_the_pin_to_the_next_viewer_in_the_same_pass() {
le... |
rust_dataset_chunk_514912 | rust_dataset.txt | 514,912 | 512 | : false
}
);
assert_eq!(mirrors.subscribers.len(), 1);
}
#[test]
fn local_input_on_a_pinned_pane_releases_it_until_a_viewer_claims_it_again() {
let (mut mirrors, _receivers) = mirrors_with(&[(1, 5, false), (2, 6, false)]);
let now = Instant::now();
mirrors.update_wish(1, size(40, 10), false... |
rust_dataset_chunk_514913 | rust_dataset.txt | 514,913 | 512 | 1, size(40, 10), false, true, now);
let typed_into: HashSet<PaneId> = [PaneId::Terminal(5)].into_iter().collect();
assert!(!mirrors.yield_panes(&typed_into));
assert_eq!(winner_of(&mirrors, 5, now), Some((1, size(40, 10))));
}
fn pinned_host() -> FakePinHost {
let mut host = FakePinHost::default();
... |
rust_dataset_chunk_514914 | rust_dataset.txt | 514,914 | 512 | _pane_the_layout_size_back() {
let (mut mirrors, _receivers) = mirrors_with(&[(1, 5, false)]);
let mut host = pinned_host();
let now = Instant::now();
pin_then_move_on(&mut mirrors, &mut host, now);
assert!(mirrors.forget_subscribers(vec![(1, MirrorRemoval::Finished)]));
mirrors.settle_pins(&mut... |
rust_dataset_chunk_514915 | rust_dataset.txt | 514,915 | 512 | ish(1, size(40, 10), false, false, now);
mirrors.settle_pins(&mut host, now);
assert_eq!(
host.program_size(PaneId::Terminal(5)),
Some(size(40, 10)),
"going back to a parked view before it settles does not resize the pane"
);
assert!(receivers[0].try_iter().any(|outgoing| matches... |
rust_dataset_chunk_514916 | rust_dataset.txt | 514,916 | 512 | _applies() {
let (mut mirrors, _receivers) = mirrors_with(&[(1, 5, false), (2, 5, false)]);
let mut host = pinned_host();
let now = Instant::now();
mirrors.update_wish(1, size(40, 10), false, true, now);
mirrors.settle_pins(&mut host, now);
assert!(mirrors.park(1));
mirrors.update_wish(2, si... |
rust_dataset_chunk_514917 | rust_dataset.txt | 514,917 | 512 | 5, false)]);
let mut host = pinned_host();
let now = Instant::now();
pin_then_move_on(&mut mirrors, &mut host, now);
let other = [PaneId::Terminal(6)];
mirrors.forget_kept_sizes(other.iter());
mirrors.settle_pins(&mut host, now);
assert_eq!(host.program_size(PaneId::Terminal(5)), Some(size(... |
rust_dataset_chunk_514918 | rust_dataset.txt | 514,918 | 512 | ::now();
mirrors.update_wish(2, size(50, 12), false, true, now);
mirrors.settle_pins(&mut host, now);
assert!(mirrors.park(2));
mirrors.settle_pins(&mut host, now);
assert_eq!(host.program_size(PaneId::Terminal(5)), Some(size(50, 12)));
mirrors.update_wish(1, size(40, 10), false, false, now);
... |
rust_dataset_chunk_514919 | rust_dataset.txt | 514,919 | 512 | Map, HashMap};
use std::path::PathBuf;
use std::time::{SystemTime, UNIX_EPOCH};
use zellij_utils::common_path::common_path_all;
use zellij_utils::pane_size::PaneGeom;
use zellij_utils::{
data::{BorderStyleOverride, LayoutMetadata, PaneMetadata, TabMetadata},
input::command::RunCommand,
input::layout::{Layou... |
rust_dataset_chunk_514920 | rust_dataset.txt | 514,920 | 512 | let panes = if tab.hide_floating_panes {
&tab.tiled_panes
} else {
&tab.floating_panes
};
for pane in panes {
for focused_client in &pane.focused_clients {
clients_metadata.insert(
*focused_c... |
rust_dataset_chunk_514921 | rust_dataset.txt | 514,921 | 512 | considered dirty if one of the following is true:
// 1. The current number of panes is different than the number of panes in the base layout
// (meaning a pane was opened or closed)
// 2. One or more terminal panes are running a command that is not the default shell
let base_layout_p... |
rust_dataset_chunk_514922 | rust_dataset.txt | 514,922 | 512 | session-manager" {
return true;
}
if location_string == "zellij:plugin-manager" {
return true;
}
if location_string == "zellij:configuration" {
return true;
}
if location_string == "zellij:share" {
... |
rust_dataset_chunk_514923 | rust_dataset.txt | 514,923 | 512 | in &mut self.tabs {
// Filter tiled panes
tab.tiled_panes.retain(|pane| {
if let PaneId::Plugin(id) = pane.id {
id != plugin_id_to_remove
} else {
true
}
});
// Filter floating panes... |
rust_dataset_chunk_514924 | rust_dataset.txt | 514,924 | 512 | Some(PathBuf::from(common_path_between_cwds));
}
let mut update_cwd_in_pane_metadata = |pane_layout_metadata: &mut PaneLayoutMetadata| {
if let PaneId::Terminal(id) = pane_layout_metadata.id {
if let Some(cwd) = terminal_ids_to_cwds.remove(&id) {
pane_lay... |
rust_dataset_chunk_514925 | rust_dataset.txt | 514,925 | 512 | name: &str| matches!(name, "vim" | "nvim" | "emacs" | "nano" | "kak");
let is_helix = |name: &str| matches!(name, "hx" | "helix");
// Narrow vi/vim lineage used for cross-matching.
// These are argument-compatible and commonly aliased to one another.
let is_vi_vim = |name: &str| matches!... |
rust_dataset_chunk_514926 | rust_dataset.txt | 514,926 | 512 | (line) = arg
.get(colon_pos + 1..)
.and_then(|s| s.parse::<usize>().ok())
{
return Some((PathBuf::from(file_part), Some(line)));
}
... |
rust_dataset_chunk_514927 | rust_dataset.txt | 514,927 | 512 | Manifest {
tiled_panes: self.tiled_panes.into_iter().map(|t| t.into()).collect(),
floating_panes: self.floating_panes.into_iter().map(|t| t.into()).collect(),
is_focused: self.is_focused,
hide_floating_panes: self.hide_floating_panes,
attention_muted: self.att... |
rust_dataset_chunk_514928 | rust_dataset.txt | 514,928 | 512 | attention_muted: bool,
ignore_output: bool,
}
impl PaneLayoutMetadata {
pub fn new(
id: PaneId,
geom: PaneGeom,
is_borderless: bool,
run: Option<Run>,
title: Option<String>,
is_focused: bool,
pane_contents: Option<String>,
focused_clients: Vec<Cl... |
rust_dataset_chunk_514929 | rust_dataset.txt | 514,929 | 512 | ,
command: Option<Run>,
}
impl ClientMetadata {
pub fn stringify_pane_id(&self) -> String {
match self.pane_id {
PaneId::Terminal(terminal_id) => format!("terminal_{}", terminal_id),
PaneId::Plugin(plugin_id) => format!("plugin_{}", plugin_id),
}
}
pub fn stringif... |
rust_dataset_chunk_514930 | rust_dataset.txt | 514,930 | 512 | >) -> PaneLayoutMetadata {
let mut run_command = RunCommand::new(PathBuf::from(command));
run_command.args = args.into_iter().map(|s| s.to_string()).collect();
PaneLayoutMetadata::new(
PaneId::Terminal(terminal_id),
PaneGeom::default(),
false,
Some... |
rust_dataset_chunk_514931 | rust_dataset.txt | 514,931 | 512 | ), None))
);
}
#[test]
fn detects_editor_pane_with_line_number_helix() {
let pane = make_command_pane(1, "hx", vec!["file.txt:50"]);
let mut meta = session_with_editor("hx", vec![pane]);
meta.detect_editor_panes();
assert_eq!(
get_first_tiled_run(&meta),
... |
rust_dataset_chunk_514932 | rust_dataset.txt | 514,932 | 512 | Some(Run::Command(rc)) => {
assert_eq!(rc.command, PathBuf::from("nvim"));
assert_eq!(rc.args, vec!["a.txt", "b.txt"]);
},
other => panic!("expected Command, got {:?}", other),
}
}
#[test]
fn detects_editor_matching_by_binary_name(... |
rust_dataset_chunk_514933 | rust_dataset.txt | 514,933 | 512 | let pane = make_command_pane(1, "vim", vec!["file.txt"]);
let mut meta = session_with_editor("emacs", vec![pane]);
meta.detect_editor_panes();
match get_first_tiled_run(&meta) {
Some(Run::Command(rc)) => assert_eq!(rc.command, PathBuf::from("vim")),
other => panic!("expe... |
rust_dataset_chunk_514934 | rust_dataset.txt | 514,934 | 512 | , SavedSessionPreview, SavedTabPreview, SessionPreview};
use zellij_utils::input::layout::{FloatingPaneLayout, Layout, Run, TiledPaneLayout};
use zellij_utils::ipc::{
ClientToServerMsg, IpcReceiverWithContext, IpcSenderWithContext, ServerToClientMsg,
};
use zellij_utils::session_index::layout_cwd;
use zellij_utils:... |
rust_dataset_chunk_514935 | rust_dataset.txt | 514,935 | 512 | tab_index: tab_index.map(|t| t as u32),
pane_id,
anchor,
}) {
return preview_error(session_name, tab_index, e.to_string());
}
#[cfg(windows)]
let mut receiver: IpcReceiverWithContext<ServerToClientMsg> =
IpcReceiverWithContext::new(reply_stream);
#[cfg(not(win... |
rust_dataset_chunk_514936 | rust_dataset.txt | 514,936 | 512 | >,
) -> Option<SessionPreview> {
let senders = senders?;
let (response_sender, response_receiver) = crossbeam::channel::bounded(1);
let sent = senders.send_to_screen(crate::screen::ScreenInstruction::GetSessionPreview {
tab_index: tab_index.map(|t| t as usize),
pane_id,
anchor,
... |
rust_dataset_chunk_514937 | rust_dataset.txt | 514,937 | 512 | _plugin(&layout.run) {
continue;
}
panes.push(SavedPanePreview {
title: layout.name.clone(),
command: command_text(&layout.run),
cwd: command_cwd(&layout.run),
contents: layout.pane_initial_contents.clone(),
focused: layout.focus.un... |
rust_dataset_chunk_514938 | rust_dataset.txt | 514,938 | 512 | error: Some(e.to_string()),
..Default::default()
},
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn saved_layout_lists_tabs_panes_and_commands() {
let folder = tempfile::tempdir().unwrap();
std::fs::write(folder.path().join("initial_contents_1"), "... |
rust_dataset_chunk_514939 | rust_dataset.txt | 514,939 | 512 | #[test]
fn running_previews_refuse_names_that_leave_the_socket_folder() {
for name in ["/tmp/zellij-preview-test", "../x", "a/b"] {
let preview = running_session_preview(name, None, None, None);
assert!(
preview
.error
.as_dere... |
rust_dataset_chunk_514940 | rust_dataset.txt | 514,940 | 512 | pub const STARTUP_CARD_MAX_WAIT: Duration = Duration::from_millis(1500);
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
struct PendingCard {
client_id: ClientId,
away_since_ms: Option<u64>,
rule: StartupCard,
deadline: Instant,
}
pub fn startup_card_should_open(
rule: StartupCard,
needs_you: usi... |
rust_dataset_chunk_514941 | rust_dataset.txt | 514,941 | 512 | _secs() {
return false;
}
LAST_ACTIVITY_REPORT_SECS
.compare_exchange(last, now, Ordering::Relaxed, Ordering::Relaxed)
.is_ok()
}
pub fn spawn_session_suggestions_service(
senders: ThreadSenders,
live_sessions: crate::attention::peers::LiveSessions,
) -> (
Sender<SessionSugg... |
rust_dataset_chunk_514942 | rust_dataset.txt | 514,942 | 512 | _version: Option<i64>,
next_index_poll: Option<Instant>,
sock_dir: PathBuf,
}
impl SessionSuggestionsService {
fn new(senders: ThreadSenders, own_sender: Sender<SessionSuggestionsJob>) -> Self {
SessionSuggestionsService {
senders,
own_sender,
index: None,
... |
rust_dataset_chunk_514943 | rust_dataset.txt | 514,943 | 512 | ) => break,
Some(SessionSuggestionsJob::SocketFolderChanged) => {
let mut exiting = false;
while let Ok(next) = receiver.try_recv() {
if next == SessionSuggestionsJob::Exit {
exiting = true;
... |
rust_dataset_chunk_514944 | rust_dataset.txt | 514,944 | 512 | ;
self.session_indicator = session_indicator;
self.configured = true;
if changed {
self.live_fact_cache.clear();
}
if !self.session_indicator {
self.watcher = None;
} else {
... |
rust_dataset_chunk_514945 | rust_dataset.txt | 514,945 | 512 | Job::Subscribe {
plugin_id,
client_id,
} => {
if self.configured && !self.session_indicator {
return;
}
self.ensure_index();
self.subscribers.insert((plugin_id, client_id));
if... |
rust_dataset_chunk_514946 | rust_dataset.txt | 514,946 | 512 | }
}
fn session_started(
&mut self,
name: String,
cwd: Option<PathBuf>,
card_for_client: Option<ClientId>,
startup_card: Option<StartupCard>,
) {
self.session_name = Some(name.clone());
if self.startup_card != StartupCard::Never || self.session_indica... |
rust_dataset_chunk_514947 | rust_dataset.txt | 514,947 | 512 | .context.folder.clone();
self.start_facts = Some(self.run_custom_facts(start_folder.as_deref(), FactTiming::Start));
self.attached_clients = self.attached_clients.max(1);
self.refresh_context(true);
}
fn focused_pane_context(&mut self, folder: Option<PathBuf>, trigger: ContextTrigger) {... |
rust_dataset_chunk_514948 | rust_dataset.txt | 514,948 | 512 | ) = self.live_fact_cache.get(folder) {
facts.extend(live.clone());
}
}
self.context.facts = facts;
let changed = self
.index
.as_ref()
.and_then(|index| index.write_context(&name, &self.context, now_secs()).ok())
.unwrap... |
rust_dataset_chunk_514949 | rust_dataset.txt | 514,949 | 512 | ) >= LAST_USED_MIN_INTERVAL)
.unwrap_or(true);
if !due {
return;
}
if let (Some(index), Some(name)) = (self.index.as_ref(), self.session_name.as_ref()) {
let _ = index.touch(name, now_secs());
self.last_used_written = Some(now);
}
}
... |
rust_dataset_chunk_514950 | rust_dataset.txt | 514,950 | 512 | resumable.push(candidate.row.name),
}
}
if running.is_empty() && resumable.is_empty() {
None
} else {
Some(FolderSessions {
folder: folder_key(folder),
running,
resumable,
... |
rust_dataset_chunk_514951 | rust_dataset.txt | 514,951 | 512 | rules = self.config.effective_rules();
let then = self.config.effective_then();
let context = self.context.clone();
let columns = self.config.columns();
let column_facts: Vec<String> = columns.iter().map(|(fact, _)| fact.clone()).collect();
let limit = limit.max(1);
let ... |
rust_dataset_chunk_514952 | rust_dataset.txt | 514,952 | 512 | );
let (result_sender, result_receiver) = channel();
let script_path = expand_home(&script.path);
let folder = context.folder.clone();
thread::spawn(move || {
let output = run_background_command_blocking(BackgroundCommand {
program: script_path.display().to_st... |
rust_dataset_chunk_514953 | rust_dataset.txt | 514,953 | 512 | desktop_window_sessions() -> Option<Vec<String>> {
let socket = zellij_utils::consts::app_control_socket();
if cfg!(unix) && !socket.exists() {
return None;
}
let state = zellij_utils::app_control::describe_app_at(&socket).ok()?;
let mut sessions: Vec<String> = state
.windows
... |
rust_dataset_chunk_514954 | rust_dataset.txt | 514,954 | 512 | (target: &SessionContext, candidate: &Candidate) -> FolderRelation {
match (&target.folder, &candidate.row.context.folder) {
(Some(target), Some(folder)) => {
let target = folder_key(target);
let folder = folder_key(folder);
if folder == target {
FolderRel... |
rust_dataset_chunk_514955 | rust_dataset.txt | 514,955 | 512 | (&raw, "").ok()?;
Some(session_layout_from_info(&info))
}
fn session_layout_from_info(
info: &zellij_utils::data::SessionInfo,
) -> (Vec<SessionPreviewTab>, usize) {
let mut tab_infos: Vec<&zellij_utils::data::TabInfo> = info.tabs.iter().collect();
tab_infos.sort_by_key(|tab| tab.position);
let tab... |
rust_dataset_chunk_514956 | rust_dataset.txt | 514,956 | 512 | ..Default::default()
})
.ok()?;
if output.exit_code != Some(0) {
return None;
}
parse_git_rev_parse(folder, &String::from_utf8_lossy(&output.stdout))
}
pub fn expand_home(path: &Path) -> PathBuf {
expand_home_with(path, std::env::var_os("HOME").map(PathBuf::from))
}
fn expand_home_wit... |
rust_dataset_chunk_514957 | rust_dataset.txt | 514,957 | 512 | !(names, vec!["running", "matching", "recent"]);
}
#[test]
fn script_candidates_are_capped() {
let ranked: Vec<RankedCandidate> = (0..150)
.map(|i| ranked(&format!("s{}", i), SessionState::Resumable, None))
.collect();
assert_eq!(script_candidates(&ranked).len(), SCR... |
rust_dataset_chunk_514958 | rust_dataset.txt | 514,958 | 512 | );
assert!(stdout.contains("fact value"), "{}", stdout);
}
#[cfg(windows)]
#[test]
fn a_custom_fact_command_can_quote_its_program_and_arguments() {
let result = run_background_command_blocking(BackgroundCommand {
timeout: Some(Duration::from_secs(5)),
..Backgroun... |
rust_dataset_chunk_514959 | rust_dataset.txt | 514,959 | 512 | name: "second".to_owned(),
..Default::default()
},
TabInfo {
position: 0,
name: "first".to_owned(),
active: true,
..Default::default()
},
],... |
rust_dataset_chunk_514960 | rust_dataset.txt | 514,960 | 512 | service, screen_receiver)
}
fn card_openings(
screen_receiver: &zellij_utils::channels::Receiver<(
ScreenInstruction,
zellij_utils::errors::ErrorContext,
)>,
) -> Vec<(ClientId, Option<u64>)> {
screen_receiver
.try_iter()
.filter_map(|... |
rust_dataset_chunk_514961 | rust_dataset.txt | 514,961 | 512 | GlobalAttentionChanged {
needs_you: 0,
scanned: true,
});
start(&mut service, Some(1));
assert!(card_openings(&screen_receiver).is_empty());
configure_startup_card(&mut service, StartupCard::Always);
start(&mut service, Some(1));
assert_eq!(card_op... |
rust_dataset_chunk_514962 | rust_dataset.txt | 514,962 | 512 | .path().join("other"), b"").unwrap();
let (mut service, screen_receiver) = service_capturing_screen(sock_dir.path());
configure_startup_card(&mut service, StartupCard::Always);
service.handle(SessionSuggestionsJob::GlobalAttentionChanged {
needs_you: 3,
scanned: true,
... |
rust_dataset_chunk_514963 | rust_dataset.txt | 514,963 | 512 | ))
) {
on_change();
}
}
})
.map_err(|e| e.to_string())?;
watcher
.watch(&folder, RecursiveMode::NonRecursive)
.map_err(|e| e.to_string())?;
Ok(SocketFolderWatcher { _watcher: w... |
rust_dataset_chunk_514964 | rust_dataset.txt | 514,964 | 512 | libc::kevent(
queue,
changes.as_ptr(),
changes.len() as libc::c_int,
std::ptr::null_mut(),
0,
std::ptr::null(),
)
};
if registered < 0 {
unsafe {
libc::clos... |
rust_dataset_chunk_514965 | rust_dataset.txt | 514,965 | 512 | FolderWatcher::start(folder.path().to_path_buf(), move || {
let _ = sender.send(());
})
.unwrap();
std::fs::write(folder.path().join("session"), b"").unwrap();
assert!(receiver.recv_timeout(Duration::from_secs(5)).is_ok());
drop(watcher);
}
#[test]
fn cha... |
rust_dataset_chunk_514966 | rust_dataset.txt | 514,966 | 512 | Clipboard::Primary => CopyDestination::Primary,
Clipboard::System => CopyDestination::System,
},
}
}
}
--- FILE: zellij/zellij-server/src/tab/copy_command.rs ---
use std::io::prelude::*;
use std::process::{Child, Command, Stdio};
use std::thread::JoinHandle;
use anyhow::{Cont... |
rust_dataset_chunk_514967 | rust_dataset.txt | 514,967 | 512 | helper: consumes stdin and then keeps running the way
// `xsel` or `xclip` do while they own the selection
fn fake_clipboard_helper(dir: &Path, received: &Path, still_alive: &Path) -> String {
let script = dir.join("fake-clipboard-helper");
std::fs::write(
&script,
forma... |
rust_dataset_chunk_514968 | rust_dataset.txt | 514,968 | 512 | (pid, Some(WaitPidFlag::WNOHANG)).err(),
Some(Errno::ECHILD),
"the copy command's process should have been reaped"
);
}
}
--- FILE: zellij/zellij-server/src/tab/layout_applier.rs ---
use zellij_utils::errors::prelude::*;
use crate::resize_pty;
use crate::tab::{get_next_terminal_po... |
rust_dataset_chunk_514969 | rust_dataset.txt | 514,969 | 512 | bool,
arrow_fonts: bool,
styled_underlines: bool,
osc8_hyperlinks: bool,
explicitly_disable_kitty_keyboard_protocol: bool,
grapheme_clusters: bool,
blocking_terminal: Option<(u32, NotificationEnd)>,
}
impl<'a> LayoutApplier<'a> {
pub fn new(
viewport: &Rc<RefCell<Viewport>>,
... |
rust_dataset_chunk_514970 | rust_dataset.txt | 514,970 | 512 | ,
terminal_emulator_color_codes,
character_cell_size,
connected_clients,
style,
display_area,
tiled_panes,
floating_panes,
pane_frame_style,
focus_pane_id,
os_api,
debug,
arrow... |
rust_dataset_chunk_514971 | rust_dataset.txt | 514,971 | 512 | }
pub fn override_layout(
&mut self,
tiled_panes_layout: TiledPaneLayout,
floating_panes_layout: Vec<FloatingPaneLayout>,
new_terminal_ids: Vec<(u32, HoldForCommand)>,
new_floating_terminal_ids: Vec<(u32, HoldForCommand)>,
mut new_plugin_ids: HashMap<RunPluginOrAl... |
rust_dataset_chunk_514972 | rust_dataset.txt | 514,972 | 512 | _applier = PaneApplier::new(
&mut self.tiled_panes,
&mut self.floating_panes,
&self.senders,
&self.character_cell_size,
);
let mut positions_left_without_exact_matches = vec![];
// look for exact matches (eg. panes that expect a specific command o... |
rust_dataset_chunk_514973 | rust_dataset.txt | 514,973 | 512 | tiled_panes_layout: &TiledPaneLayout,
mut new_terminal_ids: Vec<(u32, HoldForCommand)>,
mut new_plugin_ids: &mut HashMap<RunPluginOrAlias, Vec<u32>>,
retain_existing_terminal_panes: bool,
retain_existing_plugin_panes: bool,
client_id: ClientId,
) -> Result<HashMap<usize, Sta... |
rust_dataset_chunk_514974 | rust_dataset.txt | 514,974 | 512 | ane_ids: Vec<PaneId> = existing_tab_state.pane_ids();
pane_applier.handle_remaining_tiled_pane_ids(
remaining_pane_ids,
existing_tab_state,
last_logical_position,
Some(client_id),
);
let (focus_pane_id, pane_ids_expanded_in_stack) = match position_... |
rust_dataset_chunk_514975 | rust_dataset.txt | 514,975 | 512 | iledPaneLayout,
has_existing_panes: bool,
) -> Result<(
Vec<(TiledPaneLayout, PaneGeom)>,
HashMap<usize, StackListOrientation>,
)> {
let free_space = self.total_space_for_tiled_panes();
let tiled_panes_count = if has_existing_panes {
Some(self.tiled_panes.visi... |
rust_dataset_chunk_514976 | rust_dataset.txt | 514,976 | 512 | _stack) = self.position_new_panes(
&mut new_terminal_ids,
&mut new_plugin_ids,
&mut positions_in_layout,
)?;
self.handle_run_instructions_without_a_location(
run_instructions_without_a_location,
&mut new_terminal_ids,
);
for pa... |
rust_dataset_chunk_514977 | rust_dataset.txt | 514,977 | 512 | the details
// we got from the plugin thread and pty thread
let mut pane_ids_expanded_in_stack = vec![];
let mut focus_pane_id: Option<PaneId> = None;
let mut set_focus_pane_id = |layout: &TiledPaneLayout, pane_id: PaneId| {
if layout.focus.unwrap_or(false) && focus_pane_id.... |
rust_dataset_chunk_514978 | rust_dataset.txt | 514,978 | 512 | _plugin_pane(
&mut self,
run: RunPluginOrAlias,
new_plugin_ids: &mut HashMap<RunPluginOrAlias, Vec<u32>>,
position_and_size: &PaneGeom,
layout: &TiledPaneLayout,
) -> Result<u32> {
let err_context = || format!("Failed to start new plugin pane");
let pane_title... |
rust_dataset_chunk_514979 | rust_dataset.txt | 514,979 | 512 | new_plugin_ids
.get_mut(&run)
.and_then(|ids| ids.pop())
.with_context(err_context)?;
let mut new_pane = PluginPane::new(
pid,
position_and_size,
self.senders
.to_plugin
.as_ref()
.with_conte... |
rust_dataset_chunk_514980 | rust_dataset.txt | 514,980 | 512 | _ => None,
};
let mut new_pane = TerminalPane::new(
*pid,
position_and_size,
self.style,
next_terminal_position,
floating_pane_layout.name.clone().unwrap_or_default(),
self.link_handler.clone(),
self.character_cell_size... |
rust_dataset_chunk_514981 | rust_dataset.txt | 514,981 | 512 | _focus)
}
fn new_terminal_pane(
&mut self,
pid: u32,
hold_for_command: &HoldForCommand,
position_and_size: &PaneGeom,
layout: &TiledPaneLayout,
) -> Result<()> {
let next_terminal_position =
get_next_terminal_position(&self.tiled_panes, &self.float... |
rust_dataset_chunk_514982 | rust_dataset.txt | 514,982 | 512 | layout.attention_muted.unwrap_or(false),
layout.ignore_output.unwrap_or(false),
);
}
if let Some(held_command) = hold_for_command {
new_pane.hold(None, true, held_command.clone());
}
self.tiled_panes
.add_pane_with_exist... |
rust_dataset_chunk_514983 | rust_dataset.txt | 514,983 | 512 | () {
floating_pane_layout.logical_position = Some(logical_position);
logical_position += 1;
}
let floating_panes_layout = floating_panes_layout.iter();
let mut focused_floating_pane = None;
let mut new_floating_terminal_ids = new_floating_terminal_ids.iter();
... |
rust_dataset_chunk_514984 | rust_dataset.txt | 514,984 | 512 | _pane_layout in positions_in_layout.iter_mut() {
floating_pane_layout.logical_position = Some(logical_position);
logical_position += 1;
}
let mut existing_tab_state = ExistingTabState::new(self.floating_panes.drain());
let mut pane_applier = PaneApplier::new(
... |
rust_dataset_chunk_514985 | rust_dataset.txt | 514,985 | 512 | iscard_state_of_missing_panes();
if layout_has_floating_panes {
Ok(true)
} else {
Ok(false)
}
}
pub fn override_floating_panes_layout_for_existing_panes(
&mut self,
floating_panes_layout: &Vec<FloatingPaneLayout>,
new_terminal_ids: Vec<(u3... |
rust_dataset_chunk_514986 | rust_dataset.txt | 514,986 | 512 | floating_pane_layout);
let pid_to_focus = if let Some(Run::Plugin(run)) = floating_pane_layout.run.clone() {
self.new_floating_plugin_pane(
run,
&mut new_plugin_ids,
position_and_size,
&floating_pane_layout,
... |
rust_dataset_chunk_514987 | rust_dataset.txt | 514,987 | 512 | );
let _ = self
.senders
.send_to_pty(PtyInstruction::ClosePaneThatWasNotCreated(
PaneId::Terminal(*unused_pid),
None,
));
}
}
fn unload_unused_plugin_ids(&self, new_plugin_ids: &HashMap<RunPluginOrAlias,... |
rust_dataset_chunk_514988 | rust_dataset.txt | 514,988 | 512 | row_strips = ui_pane_geoms.iter().map(|g| ((g.y, g.rows), (g.x, g.cols)));
if let Some(remaining_rows) = LayoutApplier::shrink_by_edge_strip(
(viewport.y, viewport.rows),
(viewport.x, viewport.cols),
(geom.y, geom.rows),
ro... |
rust_dataset_chunk_514989 | rust_dataset.txt | 514,989 | 512 | _viewport(&mut self) -> Result<()> {
// here we offset the viewport after applying a tiled panes layout
// from borderless panes that are on the edges of the
// screen, this is so that when we don't have pane boundaries (eg. when they were
// disabled by the user) boundaries won't be dra... |
rust_dataset_chunk_514990 | rust_dataset.txt | 514,990 | 512 | : BTreeMap<PaneId, Box<dyn Pane>>) -> Self {
ExistingTabState { existing_panes }
}
pub fn find_and_extract_exact_match_pane(
&mut self,
run: &Option<Run>,
logical_position: Option<usize>,
) -> Option<Box<dyn Pane>> {
let candidates = self.pane_candidates();
if... |
rust_dataset_chunk_514991 | rust_dataset.txt | 514,991 | 512 | ) -> Vec<PaneId> {
self.existing_panes.keys().copied().collect()
}
pub fn remove_pane(&mut self, pane_id: &PaneId) -> Option<Box<dyn Pane>> {
self.existing_panes.remove(pane_id)
}
fn pane_candidates(&self) -> Vec<(&PaneId, &Box<dyn Pane>)> {
let mut candidates: Vec<_> = self.exis... |
rust_dataset_chunk_514992 | rust_dataset.txt | 514,992 | 512 | logical_position == logical_position)
.map(|(pid, _p)| *pid)
.copied()
}
}
struct PaneApplier<'a> {
new_focused_pane_id: Option<PaneId>,
pane_ids_expanded_in_stack: Vec<PaneId>,
tiled_panes: &'a mut TiledPanes,
floating_panes: &'a mut FloatingPanes,
senders: ThreadSender... |
rust_dataset_chunk_514993 | rust_dataset.txt | 514,993 | 512 | _layout.focus.unwrap_or(false) {
self.new_focused_pane_id = Some(pane.pid());
}
if let Some(should_be_borderless) = floating_panes_layout.borderless {
pane.set_borderless(should_be_borderless);
}
if let Some(border_style) = floating_panes_layout.border_style {
... |
rust_dataset_chunk_514994 | rust_dataset.txt | 514,994 | 512 | ,
mut existing_tab_state: ExistingTabState,
logical_position: usize,
) {
let remaining_pane_ids: Vec<PaneId> = existing_tab_state.pane_ids();
for pane_id in remaining_pane_ids {
if let Some(pane) = existing_tab_state.remove_pane(&pane_id) {
let mut positio... |
rust_dataset_chunk_514995 | rust_dataset.txt | 514,995 | 512 | /mod.rs ---
//! `Tab`s holds multiple panes. It tracks their coordinates (x/y) and size,
//! as well as how they should be resized
mod clipboard;
mod copy_command;
mod layout_applier;
mod mouse_handler;
mod popup;
mod swap_layouts;
use crate::plugins::PluginId;
use copy_command::CopyCommand;
pub use mouse_handler::{C... |
rust_dataset_chunk_514996 | rust_dataset.txt | 514,996 | 512 | ;
use self::clipboard::ClipboardProvider;
use crate::route::NotificationEnd;
use crate::{
os_input_output::ServerOsApi,
output::{CharacterChunk, KittyImageChunk, Output, SixelImageChunk},
panes::floating_panes::floating_pane_grid::half_size_middle_geom,
panes::grid::PendingNotification,
panes::kitt... |
rust_dataset_chunk_514997 | rust_dataset.txt | 514,997 | 512 | pane.get_content_rows(),
))
.with_context(err_context)
},
}
}};
($pane:expr, $os_input:expr, $senders:expr, $character_cell_size:expr) => {{
let (width_in_pixels, height_in_pixels) = {
let character_cell_size = $character_cell_size.... |
rust_dataset_chunk_514998 | rust_dataset.txt | 514,998 | 512 | PanesVisible => {
"Cannot split a pane while floating panes are visible"
},
PaneNotCreatedReason::TargetPaneNotFound => "Target pane not found",
PaneNotCreatedReason::TabNotFound => "Tab not found",
PaneNotCreatedReason::PaneToReplaceNotFound => "Pane to r... |
rust_dataset_chunk_514999 | rust_dataset.txt | 514,999 | 512 | usize,
}
fn stack_list_row_overflow_marker(hidden: usize, before: bool) -> String {
match (hidden, before) {
(0, _) => String::new(),
(hidden, true) => format!("‹{} ", hidden),
(hidden, false) => format!(" {}›", hidden),
}
}
fn stack_list_row_overflow_width(hidden: usize) -> usize {
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.