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_512600 | rust_dataset.txt | 512,600 | 512 | cursor to follow its typing", |window| {
WireColor::unpack(window.cell(moved, cursor.y).bg) != WireColor::Default
&& WireColor::unpack(window.cell(cursor.x, cursor.y).bg) == WireColor::Default
});
window.leave();
zellij.quit();
}
--- FILE: zellij/zellij-server/examples/vt_throughput.... |
rust_dataset_chunk_512601 | rust_dataset.txt | 512,601 | 512 | after each test, print the screen as the grid holds it
after the last data was sent, with its colors; lines that
wrapped are printed joined; runs each test once
--file PATH time this file instead, with every line feed sent as a
carriage return and lin... |
rust_dataset_chunk_512602 | rust_dataset.txt | 512,602 | 512 | �ÓÔÕÖØ ŒŠÙÚÛÜÝŸÞßàáâãäåæçèéêëìí");
line.push_str("îïðñòóôõöøœš ùúûüýÿþªºαΩ∞ e\u{301}a\u{308}o\u{302}u\u{300}\u{323}n\u{303}");
line.push_str("\n\t");
line.repeat(1024).into_bytes()
}
fn csi(rng: &mut Rng) -> Vec<u8> {
let mut alphabet = PRINTABLE.to_vec();
alphabet.extend_from_slice(b"\n\t");
l... |
rust_dataset_chunk_512603 | rust_dataset.txt | 512,603 | 512 | ::from_u32(0x300 + value % 0x70).unwrap_or('a'));
value /= 0x70;
}
}
text.into_bytes()
}
fn long_escape_codes(rng: &mut Rng) -> Vec<u8> {
let payload = rng.bytes_from(8024, PRINTABLE);
let mut one = b"\x1b]6;".to_vec();
one.extend_from_slice(&payload);
one.push(0x07);
on... |
rust_dataset_chunk_512604 | rust_dataset.txt | 512,604 | 512 | _render: Instant,
renders: usize,
}
impl Feeder {
fn feed(&mut self, bytes: &[u8]) {
for chunk in bytes.chunks(CHUNK) {
self.parser.feed(&mut self.grid, chunk);
self.grid.pending_messages_to_pty.clear();
self.grid.pending_forwarded_queries.clear();
if sel... |
rust_dataset_chunk_512605 | rust_dataset.txt | 512,605 | 512 | &[u8], settings: &Settings, kitten_framing: bool) {
let mut best: Option<(Duration, usize, usize)> = None;
let rounds = if settings.show { 1 } else { settings.rounds };
for _ in 0..rounds {
let result = run_once(data, settings, kitten_framing);
if best.map_or(true, |(time, _, _)| result.0 <... |
rust_dataset_chunk_512606 | rust_dataset.txt | 512,606 | 512 | files.push(path),
None => {
eprintln!("--file needs a path\n\n{}", USAGE);
std::process::exit(1);
},
},
"-h" | "--help" => {
print!("{}", USAGE);
return;
},
name if TE... |
rust_dataset_chunk_512607 | rust_dataset.txt | 512,607 | 512 | ::collections::{BTreeMap, BTreeSet};
use std::path::PathBuf;
use std::sync::mpsc::{channel, Receiver, RecvTimeoutError, Sender};
use std::sync::{Arc, Mutex, RwLock};
use std::thread;
use std::time::{Duration, Instant};
use zellij_utils::attention::{GlobalAttention, SessionAttention};
pub const PEER_SCAN_INTERVAL: Dura... |
rust_dataset_chunk_512608 | rust_dataset.txt | 512,608 | 512 | >,
},
SocketFolderChanged,
Exit,
}
#[derive(Debug, Clone, Default)]
pub struct LiveSessions(Arc<RwLock<Option<BTreeSet<String>>>>);
impl LiveSessions {
pub fn known(&self) -> Option<BTreeSet<String>> {
self.0.read().ok().and_then(|live| live.clone())
}
pub fn is_live(&self, name: &str)... |
rust_dataset_chunk_512609 | rust_dataset.txt | 512,609 | 512 | own_name.is_empty() {
live.insert(self.own_name.clone());
}
live
}
pub fn global(&self) -> GlobalAttention {
let mut sessions: Vec<(String, SessionAttention)> = self
.peers
.iter()
.map(|(name, attention)| (name.clone(), attention.clone()))... |
rust_dataset_chunk_512610 | rust_dataset.txt | 512,610 | 512 | ();
loop {
let wake_at = [Some(self.next_scan), self.push_due, self.publish_due]
.into_iter()
.flatten()
.min()
.unwrap_or(self.next_scan);
let wait = wake_at.saturating_duration_since(Instant::now());
match rece... |
rust_dataset_chunk_512611 | rust_dataset.txt | 512,611 | 512 | (&self.state.own_name.clone());
if self.last_pushed_name.is_some() {
self.push_due = Some(Instant::now());
}
self.schedule_publish();
}
}
fn ensure_watcher(&mut self) {
if self.watcher.is_some() {
return;
}
let send... |
rust_dataset_chunk_512612 | rust_dataset.txt | 512,612 | 512 | true);
}
let _ =
push_session_attention_to(app, &own_name, Some(attention.clone()), true);
}
for_each_peer(peers, |peer| {
if let Some(previous_name) = previous_name.as_ref() {
le... |
rust_dataset_chunk_512613 | rust_dataset.txt | 512,613 | 512 | )]
mod tests {
use super::*;
use zellij_utils::attention::{AttentionCounts, AttentionItem, AttentionStatus, PaneAttention};
use zellij_utils::data::PaneId;
fn attention(status: AttentionStatus) -> SessionAttention {
let pane = PaneAttention {
status,
..Default::default()... |
rust_dataset_chunk_512614 | rust_dataset.txt | 512,614 | 512 | (AttentionStatus::Failed)));
assert_eq!(state.global().counts.failed, 0);
}
#[test]
fn the_app_panel_session_never_counts_itself_or_other_app_sessions() {
let mut state = PeerAttentionState {
own_name: ".zellij-app-panel".to_owned(),
local: attention(AttentionStatus:... |
rust_dataset_chunk_512615 | rust_dataset.txt | 512,615 | 512 | consts::ipc_bind(&path).unwrap();
let (sender, receiver) = channel();
thread::spawn(move || {
for stream in listener.incoming() {
let Ok(stream) = stream else {
continue;
};
let mut incoming: IpcReceiverWithContext<ClientToS... |
rust_dataset_chunk_512616 | rust_dataset.txt | 512,616 | 512 | Job::Exit).unwrap();
service.join().unwrap();
assert_eq!(
pushed.recv_timeout(Duration::from_secs(2)).unwrap(),
("api".to_owned(), None)
);
}
#[cfg(unix)]
#[test]
fn the_panel_session_never_pushes_to_the_desktop_app() {
let dir = tempfile::tempdir... |
rust_dataset_chunk_512617 | rust_dataset.txt | 512,617 | 512 | ::{GeneralPurpose, GeneralPurposeConfig};
use base64::engine::{DecodePaddingMode, Engine as _};
use std::collections::BTreeMap;
use zellij_utils::attention::{AttentionStatus, BlockedKind, ProgramState, ProgramStatusRecord};
pub const MAX_SEQUENCE_BYTES: usize = 4096;
pub const MAX_KEY_BYTES: usize = 16;
pub const MAX... |
rust_dataset_chunk_512618 | rust_dataset.txt | 512,618 | 512 | b, b'_' | b'.' | b'+' | b'-')
}
pub fn valid_id(id: &str) -> bool {
if id.is_empty() || id.len() > MAX_ID_BYTES {
return false;
}
let segments: Vec<&str> = id.split('/').collect();
if segments.len() > MAX_ID_DEPTH {
return false;
}
segments.iter().all(|segment| {
!segmen... |
rust_dataset_chunk_512619 | rust_dataset.txt | 512,619 | 512 | all(|b| b.is_ascii_lowercase()) {
continue;
}
if key.len() > MAX_KEY_BYTES {
return None;
}
if !value.bytes().all(is_value_byte) {
continue;
}
pairs.insert(key, value);
}
let state_value = *pairs.get("state")?;
let state = i... |
rust_dataset_chunk_512620 | rust_dataset.txt | 512,620 | 512 | ProgramStatusRecords {
records: BTreeMap<String, (u64, ProgramStatusRecord)>,
sequence: u64,
working_since: BTreeMap<String, u64>,
worked: BTreeMap<String, u64>,
}
fn record_key(id: &Option<String>) -> String {
id.clone().unwrap_or_default()
}
impl ProgramStatusRecords {
pub fn is_empty(&self... |
rust_dataset_chunk_512621 | rust_dataset.txt | 512,621 | 512 | }
pub fn apply(&mut self, message: ProgramStatusMessage, now_ms: u64) -> bool {
let changed = self.apply_message(message, now_ms);
self.forget_missing();
changed
}
fn apply_message(&mut self, message: ProgramStatusMessage, now_ms: u64) -> bool {
match message {
... |
rust_dataset_chunk_512622 | rust_dataset.txt | 512,622 | 512 | map(|(parent, _)| parent.to_owned());
let mut current = match id {
None => return None,
Some(path) => parent(path),
};
loop {
let key = record_key(¤t);
if let Some(app) = self.records.get(&key).and_then(|(_, r)| r.app.clone()) {
... |
rust_dataset_chunk_512623 | rust_dataset.txt | 512,623 | 512 | b"\x1b]7501;?:states=idle,working,done,blocked,error:kinds=permission,question,auth\x1b\\".to_vec()
);
}
#[test]
fn full_report_is_parsed() {
let record = set(&format!(
"state=blocked:kind=permission:app=terraform:progress=40:msg={}:title={}",
b64("Apply ... |
rust_dataset_chunk_512624 | rust_dataset.txt | 512,624 | 512 | !(record.kind, None);
assert_eq!(record.progress, Some(7));
let record = set("state=working:progress=-1");
assert_eq!(record.progress, None);
}
#[test]
fn app_outside_charset_is_absent_and_too_long_discards() {
assert_eq!(set("state=idle:app=a,b").app, None);
assert_... |
rust_dataset_chunk_512625 | rust_dataset.txt | 512,625 | 512 | a"));
}
#[test]
fn limits_discard_the_report() {
let long_key = format!("state=idle:{}=1", "a".repeat(17));
assert_eq!(parse_body(&long_key), None);
let msg = b64(&"x".repeat(2049));
assert_eq!(parse_body(&format!("state=idle:msg={}", msg)), None);
let msg = b64(&"x"... |
rust_dataset_chunk_512626 | rust_dataset.txt | 512,626 | 512 | ").unwrap(), 2);
let ids: Vec<Option<String>> = records.iter().map(|r| r.id.clone()).collect();
assert_eq!(ids, vec![None, Some("ab".to_owned()), Some("c".to_owned())]);
records.apply(parse_body("state=clear").unwrap(), 3);
assert!(records.is_empty());
}
#[test]
fn app_is_in... |
rust_dataset_chunk_512627 | rust_dataset.txt | 512,627 | 512 | r| r.id.clone()).collect();
assert_eq!(ids, vec![Some("c".to_owned()), Some("d".to_owned())]);
}
#[test]
fn children_raise_the_pane_status() {
let mut records = ProgramStatusRecords::default();
records.apply(parse_body("state=working:app=deploy").unwrap(), 1);
records.apply(... |
rust_dataset_chunk_512628 | rust_dataset.txt | 512,628 | 512 | working").unwrap(), 40_000);
assert_eq!(records.worked_ms(&None), None);
records.clear_all();
records.apply(parse_body("state=done").unwrap(), 50_000);
assert_eq!(records.worked_ms(&None), None);
}
}
--- FILE: zellij/zellij-server/src/attention/shell.rs ---
use std::sync::OnceLock;... |
rust_dataset_chunk_512629 | rust_dataset.txt | 512,629 | 512 | #[derive(Debug, Clone, PartialEq, Eq)]
pub enum MarkKind {
PromptStart {
main: bool,
},
FreshLine,
InputStart,
CommandStart {
command: Option<CommandText>,
},
CommandEnd {
exit_code: Option<i32>,
err: Option<String>,
},
CommandText(CommandText),
Cw... |
rust_dataset_chunk_512630 | rust_dataset.txt | 512,630 | 512 | ], options: &MarkOptions) -> Option<MarkKind> {
let kind = options.prompt_kind();
match command {
b"A" | b"N" => Some(MarkKind::PromptStart {
main: !matches!(
kind,
Some(PromptKind::Secondary)
| Some(PromptKind::Continuation)
... |
rust_dataset_chunk_512631 | rust_dataset.txt | 512,631 | 512 | .as_deref() {
text = Some(decode_percent(url));
}
}
MarkKind::CommandStart {
command: text.and_then(shell_text),
}
},
b"D" => {
let exit_code = parse_exit_code(fields.first().copied());
parse_... |
rust_dataset_chunk_512632 | rust_dataset.txt | 512,632 | 512 | }
}
pub fn decode_percent(text: &str) -> String {
let bytes = text.as_bytes();
let mut out = Vec::with_capacity(bytes.len());
let mut i = 0;
while i < bytes.len() {
if bytes[i] == b'%' && i + 2 < bytes.len() {
if let (Some(h), Some(l)) = (hex_value(bytes[i + 1]), hex_value(bytes... |
rust_dataset_chunk_512633 | rust_dataset.txt | 512,633 | 512 | '),
b't' => out.push(b'\t'),
b'r' => out.push(b'\r'),
b'a' => out.push(0x07),
b'b' => out.push(0x08),
b'e' | b'E' => out.push(0x1b),
b'f' => out.push(0x0c),
b'v' => out.push(0x0b),... |
rust_dataset_chunk_512634 | rust_dataset.txt | 512,634 | 512 | 3 {
match bytes.get(i) {
Some(b) if (b'0'..=b'7').contains(b) => {
value = value * 8 + (b - b'0') as u32;
i += 1;
digits += 1;
... |
rust_dataset_chunk_512635 | rust_dataset.txt | 512,635 | 512 | OnceLock::new();
HOSTNAME.get_or_init(zellij_utils::session_index::hostname)
}
pub fn is_local_host(host: &str) -> bool {
let host = host.trim().to_ascii_lowercase();
if host.is_empty() || host == "localhost" || host == "127.0.0.1" || host == "::1" {
return true;
}
match local_hostname() {... |
rust_dataset_chunk_512636 | rust_dataset.txt | 512,636 | 512 | .is_empty() {
return None;
}
let path = without_slash_before_drive(decode_percent(path));
let is_local = is_local_host(&host);
return Some(ReportedCwd {
path,
source: CwdSource::Osc7,
host: (!host.is_empty()).then_some(host),
is... |
rust_dataset_chunk_512637 | rust_dataset.txt | 512,637 | 512 | _verbatim_drive_path(path)
}
/// A reported folder as the server may use it: never a network path, and a verbatim drive path in
/// its plain form, since cmd.exe can't start in a folder that begins with `\\`.
pub fn usable_local_path(path: &str) -> Option<&str> {
if is_network_path(path) {
return None;
... |
rust_dataset_chunk_512638 | rust_dataset.txt | 512,638 | 512 | ?/C:/x",
] {
assert!(is_network_path(path), "{:?}", path);
}
assert_eq!(
usable_local_path("\\\\?\\C:\\Users\\me"),
Some("C:\\Users\\me")
);
assert_eq!(usable_local_path("C:\\Users\\me"), Some("C:\\Users\\me"));
assert_eq!(usable_local_... |
rust_dataset_chunk_512639 | rust_dataset.txt | 512,639 | 512 | aid=42"));
assert!(main_of("133;A;redraw=last;cl=line;aid=9"));
assert!(main_of("133;N"));
assert!(main_of("133;P"));
assert!(main_of("133;P;k=i"));
assert!(!main_of("133;A;k=s"));
assert!(!main_of("133;A;k=s;click_events=1"));
assert!(!main_of("133;N;k=s"));
... |
rust_dataset_chunk_512640 | rust_dataset.txt | 512,640 | 512 | _eq!(mark133("133;B").unwrap().kind, MarkKind::InputStart);
assert_eq!(mark133("133;I").unwrap().kind, MarkKind::InputStart);
assert_eq!(mark133("133;L").unwrap().kind, MarkKind::FreshLine);
assert_eq!(mark133("133;Z"), None);
assert_eq!(command_of(mark133("133;C")), None);
asser... |
rust_dataset_chunk_512641 | rust_dataset.txt | 512,641 | 512 | }
);
assert_eq!(
mark633(r"633;E;echo a\x3b b\\c;nonce123").unwrap().kind,
MarkKind::CommandText(CommandText {
text: r"echo a; b\c".to_owned(),
source: CommandTextSource::Shell
})
);
match mark633(r"633;P;Cwd... |
rust_dataset_chunk_512642 | rust_dataset.txt | 512,642 | 512 | _osc7_uri("file://host"), None);
}
#[cfg(windows)]
#[test]
fn osc7_drive_paths_lose_the_slash_before_the_drive_letter() {
for (uri, path) in [
("file://localhost/C:/Users/me", "C:/Users/me"),
("file:///c:/a%20b", "c:/a b"),
("file:///D:", "D:/"),
... |
rust_dataset_chunk_512643 | rust_dataset.txt | 512,643 | 512 | <CommandText>,
aid: Option<String>,
},
CommandFinished {
exit_code: Option<i32>,
err: Option<String>,
aid: Option<String>,
},
Cwd(ReportedCwd),
Bell,
AlternateScreen(bool),
}
#[derive(Debug, Clone, Default)]
pub struct ShellReportState {
signals: Vec<PaneSign... |
rust_dataset_chunk_512644 | rust_dataset.txt | 512,644 | 512 | ::program_status::{ProgramStatusMessage, ProgramStatusRecords};
use super::signals::PaneSignal;
pub const STARTUP_OUTPUT_GRACE_MS: u64 = 3000;
pub const RESIZE_OUTPUT_GRACE_MS: u64 = 1500;
pub const IDLE_CHECK_THROTTLE_MS: u64 = 250;
pub const STEADY_ACTIVITY_PERCENT: u64 = 60;
pub const COMMAND_CHECK_SLACK_MS: u64 = ... |
rust_dataset_chunk_512645 | rust_dataset.txt | 512,645 | 512 | _ms = now;
}
}
fn duration_ms(&self) -> u64 {
self.last_ms.saturating_sub(self.start_ms)
}
fn is_steady(&self, activity_ms: u64) -> bool {
let duration = self.duration_ms();
if self.last_ms == 0 || duration < activity_ms {
return false;
}
let s... |
rust_dataset_chunk_512646 | rust_dataset.txt | 512,646 | 512 | .records.iter().any(|r| r.state().is_transient())
}
fn running_source(&self) -> AttentionSource {
if self.command_pane_running.is_some() && !self.command.reports_markers {
AttentionSource::CommandPane
} else if self.foreground.is_some() {
AttentionSource::ForegroundProces... |
rust_dataset_chunk_512647 | rust_dataset.txt | 512,647 | 512 | };
let head = match status {
AttentionStatus::NeedsYou => record
.kind
.map(|k| k.label().to_owned())
.unwrap_or_else(|| "needs you".to_owned()),
AttentionStatus::Failed => "failed".to_owned(),
AttentionStatus::Done => "done".to_owned(),
Attent... |
rust_dataset_chunk_512648 | rust_dataset.txt | 512,648 | 512 | (),
session_muted: false,
events: vec![],
idle_checks: vec![],
changed: BTreeSet::new(),
summary_stale: false,
}
}
pub fn config(&self) -> &AttentionConfig {
&self.config
}
pub fn set_config(&mut self, config: AttentionConfig, n... |
rust_dataset_chunk_512649 | rust_dataset.txt | 512,649 | 512 | self.idle_checks) {
match soonest.iter_mut().find(|(p, _)| *p == pane_id) {
Some((_, existing)) => *existing = (*existing).min(delay_ms),
None => soonest.push((pane_id, delay_ms)),
}
}
soonest
}
pub fn take_changed(&mut self) -> BTreeSet<P... |
rust_dataset_chunk_512650 | rust_dataset.txt | 512,650 | 512 | self.panes
.get(pane_id)
.and_then(|t| t.first_unseen_output_ms)
}
pub fn mark_seen(&mut self, pane_id: PaneId, now: u64) -> bool {
if let Some(track) = self.panes.get_mut(&pane_id) {
if track.resolved.status.is_idle() && track.reported_ms.is_some() {
... |
rust_dataset_chunk_512651 | rust_dataset.txt | 512,651 | 512 | .insert(tab_id);
} else {
self.muted_tabs.remove(&tab_id);
}
let panes: Vec<PaneId> = self
.pane_tabs
.iter()
.filter(|(_, t)| **t == tab_id)
.map(|(p, _)| *p)
.collect();
for pane_id in panes {
self.reso... |
rust_dataset_chunk_512652 | rust_dataset.txt | 512,652 | 512 | _id);
}
}
for pane_id in to_resolve {
self.resolve(pane_id, now);
}
}
pub fn set_viewed_elsewhere(&mut self, pane_id: PaneId, viewed: bool, now: u64) {
let Some(track) = self.panes.get_mut(&pane_id) else {
return;
};
if track.v... |
rust_dataset_chunk_512653 | rust_dataset.txt | 512,653 | 512 | <u64> {
if !self.config.enabled()
|| !self.config.track_commands()
|| track.interactive
|| track.reports_status()
|| track.command.phase != CommandPhase::Running
{
return None;
}
track.command.running.as_ref().map(|r| r.started_... |
rust_dataset_chunk_512654 | rust_dataset.txt | 512,654 | 512 | .activity_ms();
let scope = self.config.idle_rule();
let Some(track) = self.panes.get_mut(&pane_id) else {
return;
};
let Some(last_output) = track.last_output_ms else {
return;
};
let quiet_for = now.saturating_sub(last_output);
if quiet_f... |
rust_dataset_chunk_512655 | rust_dataset.txt | 512,655 | 512 | 64,
) {
let result = CommandResult::from_exit(exit_code, err.as_deref());
let outcome = CommandOutcome {
result,
exit_code,
err,
duration_ms: running.as_ref().map(|r| now.saturating_sub(r.started_ms)),
ended_ms: now,
command: ru... |
rust_dataset_chunk_512656 | rust_dataset.txt | 512,656 | 512 | ;
track.command.running = None;
if let Some(running) = unfinished {
self.finish_command(
pane_id,
AttentionSource::ShellCommand,
None,
None,
Some(ru... |
rust_dataset_chunk_512657 | rust_dataset.txt | 512,657 | 512 | Some(text), None) => {
let command = super::shell::clean_command_text(&text).map(|text| CommandText {
text,
source: CommandTextSource::Process,
});
track.foreground = Some(RunningCommand {
command: command.clone(... |
rust_dataset_chunk_512658 | rust_dataset.txt | 512,658 | 512 | _started_ms.is_some() {
track.command.phase = CommandPhase::Finished;
track.command.running = None;
let running = running.or_else(|| {
track
.command_pane_started_ms
.map(|started_ms| RunningCommand {
com... |
rust_dataset_chunk_512659 | rust_dataset.txt | 512,659 | 512 | }
let quiet_allowed = !has_records && command_working.is_none();
if let Some((status, record)) = track.records.deciding_record() {
if !status.is_idle() {
let past = matches!(record.state(), ProgramState::Done | ProgramState::Error);
candidates.push(Can... |
rust_dataset_chunk_512660 | rust_dataset.txt | 512,660 | 512 | since_ms: bell_ms,
past: true,
on_frame: true,
from_watch: false,
});
}
if let Some(finished) = track.finished.as_ref().filter(|f| !f.interactive) {
let outcome = &finished.outcome;
let long_enough = outcome
... |
rust_dataset_chunk_512661 | rust_dataset.txt | 512,661 | 512 | ) -> Option<&'a Candidate> {
let mut best: Option<&Candidate> = None;
for candidate in candidates {
if hidden(candidate) {
continue;
}
match best {
Some(b) if b.status >= candidate.status => {},
_ => best = Some(cand... |
rust_dataset_chunk_512662 | rust_dataset.txt | 512,662 | 512 | ast && track.acknowledged(c.since_ms))
});
let frame = match (muted, frame_best) {
(Some(MuteScope::Pane), _) | (Some(_), Some(_)) => Some(FrameMarker {
status: frame_best
.map(|c| c.status)
.unwrap_or(AttentionStatus::NewOutput),
... |
rust_dataset_chunk_512663 | rust_dataset.txt | 512,663 | 512 | (at) = track.watch_result.as_ref().map(|w| w.at_ms) {
if track.seen(at) {
track.watch_result = None;
}
}
if let Some(at) = track.quiet_ms {
if track.seen(at) {
track.quiet_ms = None;
}
}
}
pub fn tab_attenti... |
rust_dataset_chunk_512664 | rust_dataset.txt | 512,664 | 512 | : zellij/zellij-server/src/attention/unit/tracker_tests.rs ---
use super::*;
use crate::attention::program_status::parse;
use zellij_utils::attention::BlockedKind;
const PANE: PaneId = PaneId::Terminal(1);
const OTHER: PaneId = PaneId::Terminal(2);
fn report(body: &str) -> PaneSignal {
let mut params: Vec<&[u8]> ... |
rust_dataset_chunk_512665 | rust_dataset.txt | 512,665 | 512 | : None },
PaneSignal::InputStarted,
PaneSignal::CommandStarted {
command: Some(CommandText {
text: text.to_owned(),
source: CommandTextSource::Shell,
}),
aid: None,
},
],
start,
... |
rust_dataset_chunk_512666 | rust_dataset.txt | 512,666 | 512 | ("state=blocked:kind=question")], 2_000);
visible(&mut tracker, 3_000);
let attention = tracker.attention(&PANE).unwrap();
assert_eq!(attention.status, AttentionStatus::NeedsYou);
assert!(attention.seen);
}
#[test]
fn main_prompt_drops_transient_records_but_keeps_done() {
let mut tracker = tracker(... |
rust_dataset_chunk_512667 | rust_dataset.txt | 512,667 | 512 | AttentionStatus::NeedsYou);
focused(&mut tracker, 4_000);
assert!(frame(&tracker).is_none());
}
#[test]
fn bell_on_focused_pane_is_seen_immediately() {
let mut tracker = tracker();
focused(&mut tracker, 1_500);
tracker.on_signals(PANE, vec![PaneSignal::Bell], 2_000);
assert_eq!(status(&tracker... |
rust_dataset_chunk_512668 | rust_dataset.txt | 512,668 | 512 | , Some(0), None, 15_000);
assert_eq!(status(&tracker), AttentionStatus::Done);
assert_eq!(tracker.attention(&PANE).unwrap().text, "done · 11s: make");
}
#[test]
fn unknown_exit_is_done_after_threshold_never_failed() {
let mut tracker = tracker();
run_command(&mut tracker, "sleep 20", 2_000);
finish... |
rust_dataset_chunk_512669 | rust_dataset.txt | 512,669 | 512 | ]
fn mute_hides_everything_and_is_reported_as_muted() {
let mut tracker = tracker();
tracker.on_signals(PANE, vec![PaneSignal::Bell], 2_000);
tracker.set_pane_muted(PANE, true, 2_100);
let attention = tracker.attention(&PANE).unwrap().clone();
assert_eq!(attention.muted, Some(MuteScope::Pane));
... |
rust_dataset_chunk_512670 | rust_dataset.txt | 512,670 | 512 | #[test]
fn output_during_startup_is_not_new_output() {
let mut tracker = tracker();
tracker.on_output(PANE, 1_500);
assert_eq!(status(&tracker), AttentionStatus::Idle);
}
#[test]
fn new_output_clears_when_visible_and_is_not_on_frames() {
let mut tracker = tracker();
tracker.on_output(PANE, 10_000);... |
rust_dataset_chunk_512671 | rust_dataset.txt | 512,671 | 512 | AttentionStatus::Idle);
}
#[test]
fn idle_rule_does_not_fire_at_a_prompt() {
let mut tracker = tracker();
tracker.set_pane_ignore_output(PANE, true, 9_000);
tracker.on_signals(PANE, vec![PaneSignal::PromptShown { aid: None }], 9_500);
steady_output(&mut tracker, 10_000, 21_000);
tracker.idle_check... |
rust_dataset_chunk_512672 | rust_dataset.txt | 512,672 | 512 | 4_000);
focused(&mut tracker, 4_100);
assert!(tracker.attention(&PANE).unwrap().watched);
hidden(&mut tracker, 4_200);
run_command(&mut tracker, "make", 5_000);
finish(&mut tracker, Some(0), None, 6_000);
assert_eq!(status(&tracker), AttentionStatus::NeedsYou);
assert!(tracker.attention(&PAN... |
rust_dataset_chunk_512673 | rust_dataset.txt | 512,673 | 512 | from_watch);
assert!(frame(&tracker).is_none());
steady_output(&mut tracker, 25_000, 36_000);
tracker.idle_check(PANE, 39_100);
let attention = tracker.attention(&PANE).unwrap();
assert_eq!(attention.status, AttentionStatus::NeedsYou);
assert!(attention.from_watch);
assert_eq!(frame(&tracker... |
rust_dataset_chunk_512674 | rust_dataset.txt | 512,674 | 512 | finish(&mut tracker, Some(0), None, 2_100);
run_command(&mut tracker, "false", 2_200);
finish(&mut tracker, Some(1), None, 2_300);
let events = tracker.take_events();
assert!(events.contains(&AttentionEvent::PromptShown(PANE)));
assert!(events.iter().any(|e| matches!(
e,
AttentionEv... |
rust_dataset_chunk_512675 | rust_dataset.txt | 512,675 | 512 | assert_eq!(session.counts, AttentionCounts::default());
}
#[test]
fn marking_seen_clears_past_events_like_being_visible() {
let mut tracker = tracker();
tracker.on_signals(PANE, vec![PaneSignal::Bell], 2_000);
run_command(&mut tracker, "cargo test", 2_000);
finish(&mut tracker, Some(1), None, 2_500... |
rust_dataset_chunk_512676 | rust_dataset.txt | 512,676 | 512 | tracker), AttentionStatus::Idle);
tracker.on_signals(PANE, vec![report("state=done")], 15_000);
let attention = tracker.attention(&PANE).unwrap();
assert_eq!(attention.status, AttentionStatus::Done);
assert_eq!(attention.detail.duration_ms, Some(13_000));
}
#[test]
fn output_from_a_working_program_out_... |
rust_dataset_chunk_512677 | rust_dataset.txt | 512,677 | 512 |
);
tracker.set_pane_watched(PANE, true, 10_000);
tracker.on_output(PANE, 11_000);
assert_eq!(status(&tracker), AttentionStatus::Idle);
}
#[test]
fn being_visible_keeps_current_truths() {
let mut tracker = tracker();
tracker.on_signals(PANE, vec![report("state=blocked:kind=permission")], 2_000)... |
rust_dataset_chunk_512678 | rust_dataset.txt | 512,678 | 512 | ), AttentionStatus::Idle);
assert_eq!(tracker.unseen_output_since(&PANE), None);
tracker.on_output_after_resize(PANE, 12_000, false);
assert_eq!(status(&tracker), AttentionStatus::NewOutput);
assert_eq!(tracker.unseen_output_since(&PANE), Some(12_000));
}
#[test]
fn a_pane_shown_in_a_live_view_counts_a... |
rust_dataset_chunk_512679 | rust_dataset.txt | 512,679 | 512 | );
assert!(!tracker.attention(&PANE).unwrap().from_watch);
assert!(tracker.pane_is_watched(&PANE));
}
#[test]
fn with_attention_off_panes_report_nothing_until_it_is_turned_back_on() {
let off = AttentionConfig {
enabled: Some(false),
..Default::default()
};
let mut tracker = tracker... |
rust_dataset_chunk_512680 | rust_dataset.txt | 512,680 | 512 | attention = tracker.attention(&PANE).unwrap();
assert_eq!(attention.status, AttentionStatus::Working);
assert_eq!(attention.source, Some(AttentionSource::ShellCommand));
assert_eq!(attention.text, "running: cargo build");
assert_eq!(attention.remembered, None);
assert!(frame(&tracker).is_none());
... |
rust_dataset_chunk_512681 | rust_dataset.txt | 512,681 | 512 | ![PaneSignal::AlternateScreen(false)], 25_000);
finish(&mut tracker, Some(1), None, 25_100);
assert_eq!(status(&tracker), AttentionStatus::Idle);
run_command(&mut tracker, "make", 30_000);
tracker.idle_check(PANE, 40_100);
assert_eq!(
status(&tracker),
AttentionStatus::Working,
... |
rust_dataset_chunk_512682 | rust_dataset.txt | 512,682 | 512 | _user_input(PANE, 1_800);
run_command(&mut tracker, "make", 2_000);
tracker.idle_check(PANE, 12_100);
assert_eq!(status(&tracker), AttentionStatus::Working);
}
#[test]
fn panes_that_report_status_are_not_tracked_as_commands() {
let mut tracker = tracker();
run_command(&mut tracker, "claude", 2_000)... |
rust_dataset_chunk_512683 | rust_dataset.txt | 512,683 | 512 | let session = tracker.session_attention(&[(0, "t".to_owned(), vec![(PANE, "p".to_owned())])]);
assert_eq!(session.counts.done, 0, "a remembered pane is not counted");
assert_eq!(session.top, None);
}
#[test]
fn a_pane_that_only_reports_idle_is_not_remembered() {
let mut tracker = tracker();
tracker... |
rust_dataset_chunk_512684 | rust_dataset.txt | 512,684 | 512 | _eq!(remembered(&tracker), None);
tracker.on_signals(PANE, vec![report("state=working")], 6_000);
tracker.on_signals(PANE, vec![report("state=clear")], 7_000);
assert_eq!(remembered(&tracker), None);
}
#[test]
fn closing_a_remembered_pane_refreshes_the_summary() {
let mut tracker = tracker();
trac... |
rust_dataset_chunk_512685 | rust_dataset.txt | 512,685 | 512 | _file_name, session_info_folder_for_session, session_layout_cache_file_name,
VERSION, ZELLIJ_SESSION_INFO_CACHE_DIR, ZELLIJ_SOCK_DIR,
};
#[allow(unused_imports)]
use zellij_utils::data::{Event, HttpVerb, LayoutInfo, SessionInfo, WebServerStatus};
use zellij_utils::errors::{prelude::*, BackgroundJobContext, ContextT... |
rust_dataset_chunk_512686 | rust_dataset.txt | 512,686 | 512 | >,
cwd: Option<PathBuf>,
env: PaneEnv,
},
WebRequest(
PluginId,
ClientId,
String, // url
HttpVerb,
BTreeMap<String, String>, // headers
Vec<u8>, // body
BTreeMap<String, String>, // context
),
HighlightPanesWithMess... |
rust_dataset_chunk_512687 | rust_dataset.txt | 512,687 | 512 | BackgroundJob::RunCommand(..) => BackgroundJobContext::RunCommand,
BackgroundJob::RunInBackground { .. } => BackgroundJobContext::RunInBackground,
BackgroundJob::WebRequest(..) => BackgroundJobContext::WebRequest,
BackgroundJob::ReportPluginList(..) => BackgroundJobContex... |
rust_dataset_chunk_512688 | rust_dataset.txt | 512,688 | 512 | 2000;
static STARTUP_TRIM_ALLOCATOR_DELAY_MS: u64 = 10000;
#[cfg(all(target_os = "linux", target_env = "gnu"))]
fn trim_allocator() {
unsafe {
libc::malloc_trim(0);
}
}
#[cfg(not(all(target_os = "linux", target_env = "gnu")))]
fn trim_allocator() {}
static FLASH_DURATION_MS: u64 = 400; // Doherty thre... |
rust_dataset_chunk_512689 | rust_dataset.txt | 512,689 | 512 | {
self.pending = Some(PendingRender {
first_request: now,
last_request: now,
immediate_at: Some(now),
});
},
}
}
fn step(&mut self, now: Instant) -> RenderStep {
if self.exiting {
... |
rust_dataset_chunk_512690 | rust_dataset.txt | 512,690 | 512 | SESSION_SCAN_STATE: std::sync::OnceLock<SessionScanState> = std::sync::OnceLock::new();
pub fn session_scan_state() -> Option<&'static SessionScanState> {
SESSION_SCAN_STATE.get()
}
#[allow(unused_variables)] // web_server_base_url used only with web_server_capability feature
pub(crate) fn background_jobs_main(
... |
rust_dataset_chunk_512691 | rust_dataset.txt | 512,691 | 512 | utex<HashMap<PaneId, Instant>>> =
Arc::new(Mutex::new(HashMap::new()));
let mut flashing_pane_bells: HashMap<PaneId, Arc<AtomicBool>> = HashMap::new();
let mut flashing_tab_bells: HashMap<usize, Arc<AtomicBool>> = HashMap::new();
let mut nested_guest_pings: HashMap<PaneId, Arc<AtomicBool>> = HashMap... |
rust_dataset_chunk_512692 | rust_dataset.txt | 512,692 | 512 | let current_session_name = current_session_name.clone();
let current_session_info = current_session_info.clone();
let current_session_layout = current_session_layout.clone();
let session_id = session_id.clone();
let stopped = session_metadata_writer_stopped.clone();
runti... |
rust_dataset_chunk_512693 | rust_dataset.txt | 512,693 | 512 | (
ScreenInstruction::ProgressPluginLoadingOffset(pid),
);
tokio::time::sleep(std::time::Duration::from_millis(
PLUGIN_ANIMATION_OFFSET_DURATION_MD,
))
... |
rust_dataset_chunk_512694 | rust_dataset.txt | 512,694 | 512 | let exit_code = Some(2);
let _ = senders.send_to_plugin(PluginInstruction::Update(vec![(
Some(plugin_id),
Some(client_id),
Event::RunCommandResult(exit_code, stdout, stderr, conte... |
rust_dataset_chunk_512695 | rust_dataset.txt | 512,695 | 512 | , likely due to a misconfigured http client");
return;
};
match web_request(url, verb, headers, body, http_client).await {
Ok((status, headers, body)) => {
let _ = senders.send_to_plu... |
rust_dataset_chunk_512696 | rust_dataset.txt | 512,696 | 512 | time::Duration::from_millis(FLASH_DURATION_MS))
.await;
let _ = senders.send_to_screen(
ScreenInstruction::ClearPaneFrameColorOverride(pane_ids),
);
}
});
},
... |
rust_dataset_chunk_512697 | rust_dataset.txt | 512,697 | 512 | BackgroundJob::AttentionIdleCheck(pane_id, delay_ms) => {
let should_spawn = {
let mut pending = pending_attention_idle_checks.lock().unwrap();
let deadline = Instant::now() + Duration::from_millis(delay_ms);
let should_spawn = !pen... |
rust_dataset_chunk_512698 | rust_dataset.txt | 512,698 | 512 | ().unwrap();
state.0 = Some(Instant::now());
state.1.take()
};
if let Some(status) = status {
let _ = senders.send_to_server(
... |
rust_dataset_chunk_512699 | rust_dataset.txt | 512,699 | 512 | {
let _ = senders.send_to_screen(
ScreenInstruction::AddHighlightPaneFrameColorOverride(
pane_ids_clone.clone(),
None,
),
);
to... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.