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_516600
rust_dataset.txt
516,600
512
Arc::default(); let policy = Policy { statuses: StatusSet::of(&POPUP_STATUSES), details, ..Policy::default() }; let recorded = events.clone(); let kept = latest.clone(); std::thread::Builder::new() .name("notification_probe".to_own...
rust_dataset_chunk_516601
rust_dataset.txt
516,601
512
--- FILE: zellij/zellij-terminal/src/app/tests.rs --- use super::*; use crate::app::desktop::notifier; use crate::app::desktop::notifier::recording::{Recorded, Recorder}; use crate::app::policy::model::fixtures::*; use zellij_utils::attention::AttentionStatus; fn background() -> (Background, Recorder) { let record...
rust_dataset_chunk_516602
rust_dataset.txt
516,602
512
view: Some(PopupView::Sessions), at: None, token: None }] ); assert_eq!( background.adjust_intent(Intent::Popup { view: Some(PopupView::Quit), at: None, token: None }), Intent::Popup { view: Some(PopupView::...
rust_dataset_chunk_516603
rust_dataset.txt
516,603
512
other => panic!("expected one notification, got {:?}", other), }; background.on_notification(SinkEvent::Clicked { id: id.clone(), token: None, }); assert_eq!(wait_for(&recorder, 1), vec![Recorded::Withdraw(id)]); let later = now + engine::FIRST_SHOW_DELAY * 4; background.on_snap...
rust_dataset_chunk_516604
rust_dataset.txt
516,604
512
ayIcon); assert!(background.tray_visible()); background.on_request(AppRequest::ToggleTrayIcon); assert!(!background.tray_visible()); background.on_snapshot(snapshot(vec![]), now); background.on_snapshot( snapshot(vec![item(1, AttentionStatus::NeedsYou, "x", 1)]), now, ); back...
rust_dataset_chunk_516605
rust_dataset.txt
516,605
512
_own_view_and_switches_another() { use PopupView::*; assert_eq!(panel_toggle(None, false, Inbox, None), PanelToggle::Open); assert_eq!( panel_toggle(Some(Inbox), false, Inbox, None), PanelToggle::Close ); assert_eq!( panel_toggle(Some(Sessions), false, Inbox, None), P...
rust_dataset_chunk_516606
rust_dataset.txt
516,606
512
() { let dir = tempfile::TempDir::new().unwrap(); let path = dir.path().join("config.kdl"); std::fs::write(&path, "default_mode \"locked\"\n").unwrap(); let (mut background, _) = background(); background.config_path = Some(path.clone()); let now = Instant::now(); background.on_tray( ...
rust_dataset_chunk_516607
rust_dataset.txt
516,607
512
macos", allow(dead_code))] pub display_name: &'static str, } impl Identity { #[cfg_attr(not(windows), allow(dead_code))] pub fn windows_app_id(&self) -> String { windows_app_id(self.name) } } pub fn identity() -> Identity { identity_of(distribution()) } pub fn identity_of(distribution: &D...
rust_dataset_chunk_516608
rust_dataset.txt
516,608
512
not the display name" ); } #[test] fn a_distribution_can_choose_its_desktop_app_id() { let acme = Distribution::new("acme", "1.0.0").with_app_id("com.acme.Shell"); let identity = identity_of(&acme); assert_eq!(identity.app_id, "com.acme.Shell"); assert_eq!(identity....
rust_dataset_chunk_516609
rust_dataset.txt
516,609
512
; --- FILE: zellij/zellij-terminal/src/config/options.rs --- use zellij_utils::data::{BareKey, HostTerminalThemeMode, KeyWithModifier, PaletteColor, Styling}; use zellij_utils::input::terminal::{ BellMode, CursorStyle, OptionAsAlt, PaddingColor, StartupMode, TerminalConfig, TerminalTheme, TitlebarTheme, }; us...
rust_dataset_chunk_516610
rust_dataset.txt
516,610
512
100; pub const DEFAULT_SCROLL_MOMENTUM_FRICTION: f32 = 2.0; #[derive(Debug, Clone, Copy, PartialEq, Default)] pub struct Padding { pub top: f32, pub right: f32, pub bottom: f32, pub left: f32, } impl Padding { pub fn of(section: &TerminalConfig) -> Self { let all = section.padding.unwrap_o...
rust_dataset_chunk_516611
rust_dataset.txt
516,611
512
}, paste_keys: section .paste_keys .clone() .unwrap_or_else(default_paste_keys), zoom_in_keys: section .zoom_in_keys .clone() .unwrap_or_else(default_zoom_in_keys), zoom_out_keys: section .zoom_out_keys ...
rust_dataset_chunk_516612
rust_dataset.txt
516,612
512
omentum_friction: f64::from( section .scroll_momentum_friction .unwrap_or(DEFAULT_SCROLL_MOMENTUM_FRICTION), ), option_as_alt: section.macos_option_as_alt.unwrap_or_default(), reuse_session_windows: section.reuse_session_windows.unwrap_or(true), ...
rust_dataset_chunk_516613
rust_dataset.txt
516,613
512
Char('c')) .with_ctrl_modifier() .with_shift_modifier()]; keys.extend(command(platform, &[BareKey::Char('c')])); keys } fn zoom_in_keys_for(platform: Platform) -> Vec<KeyWithModifier> { let mut keys = vec![ KeyWithModifier::new(BareKey::Char('=')).with_ctrl_modifier(), KeyWi...
rust_dataset_chunk_516614
rust_dataset.txt
516,614
512
configured = |pick: fn(&TerminalTheme) -> Option<PaletteColor>| { section.and_then(pick).map(|color| srgb(color, &table)) }; let derived = |pick: fn(&Styling) -> PaletteColor| theme.map(|t| srgb(pick(&t.palette), &table)); paints.foreground = configured(|section| section.foreground) ...
rust_dataset_chunk_516615
rust_dataset.txt
516,615
512
next.zoom_out_keys || current.zoom_reset_keys != next.zoom_reset_keys, middle_click_paste: current.middle_click_paste != next.middle_click_paste, open_links: current.open_links != next.open_links || current.open_links_with_shift != next.open_links_with_shift, ...
rust_dataset_chunk_516616
rust_dataset.txt
516,616
512
) -> bool { self.paints || self.cursor_shape || self.cursor_blink || self.transparency || self.padding_color || self.cursor_unfocused_hollow || self.minimum_contrast } } #[cfg(test)] mod tests { use super::*; use std::str::From...
rust_dataset_chunk_516617
rust_dataset.txt
516,617
512
the_defaults_are_those_of_the_platform_being_built_for() { assert_eq!(default_paste_keys(), paste_keys_for(Platform::current())); assert_eq!( default_zoom_in_keys(), zoom_in_keys_for(Platform::current()) ); } fn settings(section: TerminalConfig) -> Settings { ...
rust_dataset_chunk_516618
rust_dataset.txt
516,618
512
shipped bell must stay the window attention the window always requested" ); assert_eq!(options.paints, Paints::default()); assert_eq!( options.cursor_shape, None, "with nothing configured the shape the session asks for is the shape that is drawn" ); asser...
rust_dataset_chunk_516619
rust_dataset.txt
516,619
512
_shift_c.clone()]); assert_eq!(copy_keys_for(Platform::MacOs), [ctrl_shift_c, cmd('c')]); } #[test] fn the_selection_and_link_options_are_read_and_their_changes_noticed() { let current = resolve(&Settings::default(), None); let next = resolve( &settings(TerminalConfig { ...
rust_dataset_chunk_516620
rust_dataset.txt
516,620
512
_is_no_family_at_all() { let options = resolve( &settings(TerminalConfig { font: Some(" ".to_owned()), ..TerminalConfig::default() }), None, ); assert_eq!(options.font.family, None); } #[test] fn per_style_familie...
rust_dataset_chunk_516621
rust_dataset.txt
516,621
512
s.foreground, [9, 9, 9], "the configured table must be in place before a theme index is read through it" ); assert_eq!(options.paints.background, ANSI_16[0]); } #[test] fn the_window_section_supersedes_the_session_theme() { let mut settings = themed(PaletteCo...
rust_dataset_chunk_516622
rust_dataset.txt
516,622
512
, PaletteColor::Rgb((9, 9, 9))), (2, PaletteColor::Rgb((7, 7, 7))), ]), ); settings.section.theme = Some(TerminalTheme { ansi: { let mut ansi = [None; 16]; ansi[1] = Some(PaletteColor::Rgb((1, 1, 1))); ansi ...
rust_dataset_chunk_516623
rust_dataset.txt
516,623
512
s; assert_eq!(painted(HostTerminalThemeMode::Dark).ansi[1], [11, 11, 11]); assert_eq!(painted(HostTerminalThemeMode::Light).ansi[1], [22, 22, 22]); } #[test] fn a_theme_with_no_terminal_colors_leaves_the_xterm_entries_alone() { let options = resolve( &themed(PaletteColor...
rust_dataset_chunk_516624
rust_dataset.txt
516,624
512
expect("the chord must parse"); options.zoom_in_keys.contains(&key) || options.zoom_out_keys.contains(&key) || options.zoom_reset_keys.contains(&key) }; for chord in ["Ctrl =", "Ctrl +", "Ctrl Shift +", "Ctrl -", "Ctrl 0"] { assert!(bound(chord), "...
rust_dataset_chunk_516625
rust_dataset.txt
516,625
512
} #[test] fn an_unconfigured_window_is_solid_and_unblurred() { let options = Options::default(); assert_eq!(options.transparency, Transparency::OPAQUE); assert_eq!(options.transparency.opacity, 1.0); assert_eq!(options.transparency.mode, OpacityMode::Background); assert...
rust_dataset_chunk_516626
rust_dataset.txt
516,626
512
_without_a_redraw() { let current = Options::default(); let mut next = current.clone(); next.option_as_alt = OptionAsAlt::None; let change = Change::between(&current, &next); assert_eq!( change, Change { option_as_alt: true, ...
rust_dataset_chunk_516627
rust_dataset.txt
516,627
512
_eq!(options.font.weight, 500); assert_eq!(options.font.features.len(), 1); let current = Options::default(); let mut next = current.clone(); next.padding.top = 3.0; let change = Change::between(&current, &next); assert!(change.layout && change.is_anything() && !change.f...
rust_dataset_chunk_516628
rust_dataset.txt
516,628
512
::time::Duration::from_millis(250) ); let change = Change::between(&Options::default(), &options); assert!(change.scroll_animation && change.is_anything() && !change.needs_redraw()); } #[test] fn scroll_momentum_is_on_by_default_with_the_default_friction() { let options = Op...
rust_dataset_chunk_516629
rust_dataset.txt
516,629
512
format!("failed to read the configuration at {:?}", path))? } else { defaults }; config.themes = config.themes.merge(get_default_themes()); if let Some(theme_dir) = theme_dir(&config, config_dir) { let themes = Themes::from_dir(theme_dir.clone()) .map_err(|e| anyhow::anyhow...
rust_dataset_chunk_516630
rust_dataset.txt
516,630
512
) -> (tempfile::TempDir, PathBuf) { let dir = tempfile::TempDir::new().unwrap(); let path = dir.path().join("config.kdl"); std::fs::write(&path, config).unwrap(); (dir, path) } fn theme(name: &str, base: u8) -> String { format!( r#" {name} {{ ...
rust_dataset_chunk_516631
rust_dataset.txt
516,631
512
let (_dir, path) = written( "unknown {\n font \"Iosevka Term\"\n font_size 18\n}\nterminal {\n font_size 19\n}\n", ); let settings = load(Some(&path)).expect("an unknown section is ignored, not an error"); assert_eq!(settings.section.font, None); assert_eq!(settings.s...
rust_dataset_chunk_516632
rust_dataset.txt
516,632
512
fn a_theme_that_is_not_configured_falls_back_to_the_bundled_default() { let (_dir, path) = written("terminal {\n font_size 18\n}\n"); let settings = load(Some(&path)).unwrap(); assert_eq!( settings.theme(Some(HostTerminalThemeMode::Dark)), settings.theme, "th...
rust_dataset_chunk_516633
rust_dataset.txt
516,633
512
Dark), Some(HostTerminalThemeMode::Light), ] { assert_eq!( settings.theme(mode).unwrap().palette.text_unselected.base, PaletteColor::Rgb((2, 2, 2)), "{:?} moved a theme the session would not have moved", mode ); ...
rust_dataset_chunk_516634
rust_dataset.txt
516,634
512
(state) } pub fn save_to(path: &Path, state: WindowState) -> Result<()> { let text = serde_json::to_string(&state).context("failed to describe the window state")?; if let Some(parent) = path.parent() { std::fs::create_dir_all(parent) .with_context(|| format!("failed to create {:?}", parent)...
rust_dataset_chunk_516635
rust_dataset.txt
516,635
512
StartupMode, saved: Option<WindowState>, rows: Option<usize>, cols: Option<usize>, initial: InitialCells, ) -> Self { let saved = match mode { StartupMode::Remember => saved.filter(WindowState::is_sane), _ => None, }; let initial = Ini...
rust_dataset_chunk_516636
rust_dataset.txt
516,636
512
(); let value: serde_json::Value = serde_json::from_str(&text).unwrap(); assert_eq!(value["cols"], 90); assert_eq!(value["rows"], 30); assert_eq!(value["state"], "maximized"); } #[test] fn a_missing_empty_corrupt_or_out_of_range_file_loads_nothing() { let dir = TempD...
rust_dataset_chunk_516637
rust_dataset.txt
516,637
512
().join("file"); std::fs::write(&blocker, "").unwrap(); let path = blocker.join(FILE_NAME); assert!(save_to(&path, state(90, 30, Shown::Windowed)).is_err()); store(&path, state(90, 30, Shown::Windowed)); } #[test] fn remember_uses_the_saved_cells_and_state() { let st...
rust_dataset_chunk_516638
rust_dataset.txt
516,638
512
assert_eq!(startup.mode, mode); assert!(!startup.restored); } } #[test] fn explicit_rows_and_cols_win_over_the_saved_ones() { let saved = Some(state(90, 30, Shown::Maximized)); let startup = Startup::resolve(StartupMode::Remember, saved, Some(24), Some(80)); ...
rust_dataset_chunk_516639
rust_dataset.txt
516,639
512
)*)) }; } pub fn emit(message: &str) { eprintln!("zellij-terminal: {}", message); log::warn!("{}", message); } pub fn log_file() -> PathBuf { zellij_utils::consts::ZELLIJ_TMP_LOG_FILE.clone() } pub fn log_crashes() { let previous = std::panic::take_hook(); std::panic::set_hook(Box::new(move |...
rust_dataset_chunk_516640
rust_dataset.txt
516,640
512
rgb = [u8; 3]; pub const DEFAULT_FOREGROUND: Srgb = [229, 229, 229]; pub const DEFAULT_BACKGROUND: Srgb = [0, 0, 0]; pub const ANSI_16: [Srgb; 16] = [ [0, 0, 0], [205, 0, 0], [0, 205, 0], [205, 205, 0], [0, 0, 238], [205, 0, 205], [0, 205, 205], [229, 229, 229], [127, 127, 127], ...
rust_dataset_chunk_516641
rust_dataset.txt
516,641
512
, default: Srgb) -> Srgb { match WireColor::unpack(packed) { WireColor::Default => default, WireColor::Named(index) => self.ansi[(index as usize).min(15)], WireColor::Indexed(index) => self.indexed(index), WireColor::Rgb(r, g, b) => [r, g, b], } } } f...
rust_dataset_chunk_516642
rust_dataset.txt
516,642
512
let (light, dark) = if a >= b { (a, b) } else { (b, a) }; (light + 0.05) / (dark + 0.05) } fn blend(from: Srgb, to: Srgb, step: u32) -> Srgb { let mut out = from; for channel in 0..3 { let (start, end) = (from[channel] as i32, to[channel] as i32); out[channel] = (start + ((end ...
rust_dataset_chunk_516643
rust_dataset.txt
516,643
512
} pub fn minimum(&self) -> f32 { self.minimum } pub fn is_active(&self) -> bool { self.minimum > 1.0 } pub fn apply(&self, foreground: Srgb, background: Srgb) -> Srgb { if !self.is_active() { return foreground; } let mut cache = self.cache.borr...
rust_dataset_chunk_516644
rust_dataset.txt
516,644
512
208) ); assert_eq!(paints.foreground(WireColor::Rgb(9, 8, 7).pack()), [9, 8, 7]); assert_eq!(paints.background(WireColor::Rgb(9, 8, 7).pack()), [9, 8, 7]); } #[test] fn a_configured_table_answers_named_and_indexed_colors_alike() { let mut paints = paints(); paints.an...
rust_dataset_chunk_516645
rust_dataset.txt
516,645
512
() < 1e-9); assert!((contrast_ratio(BLACK, WHITE) - 21.0).abs() < 1e-9); assert!((contrast_ratio([120, 30, 200], [120, 30, 200]) - 1.0).abs() < 1e-9); assert!((contrast_ratio([0x77, 0x77, 0x77], WHITE) - 4.48).abs() < 0.01); assert!((contrast_ratio([0xff, 0x00, 0x00], WHITE) - 4.0).abs()...
rust_dataset_chunk_516646
rust_dataset.txt
516,646
512
60, 60], 3.0); assert!(lightened[0] > 90, "{:?}", lightened); let darkened = with_minimum_contrast([170, 170, 170], [200, 200, 200], 3.0); assert!(darkened[0] < 170, "{:?}", darkened); let unreachable = with_minimum_contrast([118, 118, 118], [118, 118, 118], 21.0); let mid = [11...
rust_dataset_chunk_516647
rust_dataset.txt
516,647
512
rgb = DEFAULT_FOREGROUND; pub fn indexed(index: u8) -> Srgb { Paints::default().indexed(index) } --- FILE: zellij/zellij-terminal/src/emulation/damage.rs --- #[derive(Debug, Clone, PartialEq, Eq)] pub enum Damage { Everything, Rows(Vec<usize>), } impl Damage { #[cfg(test)] pub fn of(rows: impl I...
rust_dataset_chunk_516648
rust_dataset.txt
516,648
512
]) -> Option<NotificationChunk> { if let Some(rest) = osc.strip_prefix(b"9;") { return Some(NotificationChunk { id: None, title: false, text: String::from_utf8(rest.to_vec()).ok()?, done: true, }); } let rest = osc.strip_prefix(b"99;")?; le...
rust_dataset_chunk_516649
rust_dataset.txt
516,649
512
osc.starts_with(b"9;") || osc.starts_with(b"99;") { return notification_chunk(osc).map(OscSignal::Notification); } if let Some(body) = title_body(osc) { return match String::from_utf8(body.to_vec()) { Ok(title) if title.is_empty() => Some(OscSignal::Title(None)), Ok(titl...
rust_dataset_chunk_516650
rust_dataset.txt
516,650
512
.state { FilterState::Ground => match byte { 0x1b => { self.state = FilterState::Esc; Step::forward(&[]) }, 0x00..=0x1f | 0x7f => Step::boundary(&[byte]), other => Step::forward(&[other]), }, ...
rust_dataset_chunk_516651
rust_dataset.txt
516,651
512
) => Step::signal(terminator, signal), None => Step::boundary(terminator), } } fn control_sequence(&mut self, byte: u8) -> Step { match byte { 0x1b => { self.state = FilterState::Esc; Step::forward(&[]) }, 0x20..=0x...
rust_dataset_chunk_516652
rust_dataset.txt
516,652
512
resident| &resident.image) } pub fn revision(&self, id: u32) -> Option<u64> { self.images.get(&id).map(|resident| resident.revision) } pub fn resident_ids(&self) -> Vec<u32> { self.images.keys().copied().collect() } pub fn placements(&self) -> impl Iterator<Item = &Placement> ...
rust_dataset_chunk_516653
rust_dataset.txt
516,653
512
path, e); return None; }, }; match file.metadata() { Ok(metadata) if metadata.is_file() => {}, Ok(_) => { report!( "refusing to read graphics media from {:?}: not a file", path ); return None; }, ...
rust_dataset_chunk_516654
rust_dataset.txt
516,654
512
fs::write(&path, vec![7u8; 64]).unwrap(); assert_eq!( read_shared_media(&path.to_string_lossy(), 16), Some(vec![7u8; 16]) ); assert_eq!(read_shared_media(&path.to_string_lossy(), 65), None); } #[cfg(unix)] #[test] fn shared_media_that_is_not_a_plain_file_...
rust_dataset_chunk_516655
rust_dataset.txt
516,655
512
"\x1b[?2J"[..], &b"\x1b[2;3H"[..], ] { let (text, clears) = observed(stream); assert_eq!(text, stream, "{:?}", stream); assert_eq!(clears, 0, "{:?}", stream); } } #[test] fn an_aborted_control_sequence_does_not_carry_its_parameters_forward() {...
rust_dataset_chunk_516656
rust_dataset.txt
516,656
512
{ let (text, clears) = observed(stream); assert_eq!( text, stream, "nothing captures graphics any more; {:?} must reach the parser whole", stream ); assert_eq!(clears, 0, "{:?}", stream); } } #[test] fn...
rust_dataset_chunk_516657
rust_dataset.txt
516,657
512
last().unwrap(), "boundary"); assert_eq!(*steps(b"\t").last().unwrap(), "boundary"); assert_eq!(*steps(b"\x7f").last().unwrap(), "boundary"); assert_eq!(*steps(b"\x1b[2J").last().unwrap(), "cleared"); } #[test] fn a_boundary_carries_its_bytes_so_the_parser_still_sees_them() { ...
rust_dataset_chunk_516658
rust_dataset.txt
516,658
512
color: xparse_color(paints.foreground), }, ClientToServerMsg::BackgroundColor { color: xparse_color(paints.background), }, ClientToServerMsg::ColorRegisters { color_registers: color_registers(paints), }, ] } fn color_registers(paints: &Paints) -> Vec...
rust_dataset_chunk_516659
rust_dataset.txt
516,659
512
seeded[1], ClientToServerMsg::BackgroundColor { color: xparse_color([4, 5, 6]) } ); assert_eq!(color_registers(&paints)[1].color, xparse_color([1, 2, 3])); } } --- FILE: zellij/zellij-terminal/src/emulation/screen_buffer.rs --- use std::collectio...
rust_dataset_chunk_516660
rust_dataset.txt
516,660
512
found } => write!( f, "a frame claimed a {}x{} viewport, which has no cells", found.0, found.1 ), } } } impl std::error::Error for ApplyError {} #[derive(Debug, Clone, PartialEq, Eq)] pub struct Applied { pub seq: u64, pub cleared: bool,...
rust_dataset_chunk_516661
rust_dataset.txt
516,661
512
::Default, _ => CursorShape::Block, } } pub fn cursor_is_blinking(&self) -> bool { self.cursor.blinking() } pub fn occupancy(&self, row: usize, col: usize) -> Occupancy { if self.cell(row, col).is_wide_head() { return Occupancy::WideHead; } ...
rust_dataset_chunk_516662
rust_dataset.txt
516,662
512
} } let mut end = start + cell_width(&self.cell(row, start)); while end < self.cols && self.is_group_continuation(row, end) { end += cell_width(&self.cell(row, end)); } UnitSpan { start, end: end.min(self.cols).max(col + 1), ...
rust_dataset_chunk_516663
rust_dataset.txt
516,663
512
&& !header.full_repaint() { return Err(ApplyError::ReshapeWithoutFullRepaint { expected: (self.rows, self.cols), found: (rows, cols), }); } if reshaped { self.cols = cols; self.rows = rows; self.cells = vec![Wir...
rust_dataset_chunk_516664
rust_dataset.txt
516,664
512
(1), )); } } frame.apply(&mut self.cells, self.cols, self.rows); self.resolve_clusters(frame); let before = self.cursor; self.cursor = frame.cursor(); let cursor_rows = (before != self.cursor).then(|| { ( (before.y a...
rust_dataset_chunk_516665
rust_dataset.txt
516,665
512
1) * self.cols] .iter() .filter(|cell| cell.has(ATTR_SLOW_BLINK) || cell.has(ATTR_FAST_BLINK)) .count(); self.blinking = self.blinking + counted - self.blinking_rows[row]; self.blinking_rows[row] = counted; } } #[cfg(test)] mod tests { use super::*; use c...
rust_dataset_chunk_516666
rust_dataset.txt
516,666
512
applied.seq, 3); assert!(!applied.cleared); assert_eq!(row_text(&buffer, 0), " abc "); assert_eq!(row_text(&buffer, 1), " zz"); assert_eq!( applied.written, vec![Span::new(0, 1, 3), Span::new(1, 4, 5)] ); } #[test] fn a_partial_frame_leave...
rust_dataset_chunk_516667
rust_dataset.txt
516,667
512
second.set_clear(true); second.push_row(0, 0, &run("ab")); let applied = apply(&mut buffer, &second.finish()).unwrap(); assert!(applied.cleared); assert!(!applied.reshaped); assert_eq!(row_text(&buffer, 0), "ab "); assert_eq!(row_text(&buffer, 1), " "); } ...
rust_dataset_chunk_516668
rust_dataset.txt
516,668
512
{ let mut buffer = ScreenBuffer::new(4, 8); let mut builder = FrameBuilder::new(8, 4, 0); builder.set_cursor(CursorState { x: 5, y: 2, shape: CURSOR_SHAPE_BEAM | zellij_utils::structured_render::CURSOR_BLINKING, visible: true, }); ...
rust_dataset_chunk_516669
rust_dataset.txt
516,669
512
assert_eq!(buffer.occupancy(0, 2), Occupancy::Single); } #[test] fn blink_is_read_off_the_cells_rather_than_tracked_alongside_them() { let mut buffer = ScreenBuffer::new(1, 4); let mut builder = FrameBuilder::new(4, 1, 0); builder.push_row( 0, 0, ...
rust_dataset_chunk_516670
rust_dataset.txt
516,670
512
2, 2); assert_eq!(buffer.cell(9, 9), WireCell::BLANK); assert_eq!(buffer.occupancy(9, 9), Occupancy::Single); assert_eq!(buffer.blink_at(9, 9), Blink::default()); } #[test] fn a_cell_resolves_its_url_through_the_table_the_frame_carried() { let mut buffer = ScreenBuffer::new(...
rust_dataset_chunk_516671
rust_dataset.txt
516,671
512
&[(0, 0, "ab ", &[5, 5, 0, 0, 0, 0])], &[ (5, "https://example.com/before"), (6, "https://example.com/x"), ], ); apply(&mut buffer, &first).unwrap(); let second = painter::linked_frame( 1, 6, 1, ...
rust_dataset_chunk_516672
rust_dataset.txt
516,672
512
_count(), 1); } #[test] fn a_group_keeps_each_member_text_and_marks_the_members_after_the_first() { let mut buffer = ScreenBuffer::new(1, 8); painted(&mut buffer, |p| { p.group( 0, 0, &[(FAMILY_MAN, 2), (FAMILY_WOMAN, 2), (FAMILY_G...
rust_dataset_chunk_516673
rust_dataset.txt
516,673
512
assert_eq!( occupancy, vec![ Occupancy::Single, Occupancy::WideHead, Occupancy::WideTail, Occupancy::WideHead, Occupancy::WideTail, Occupancy::WideTail, Occupancy::Single, ...
rust_dataset_chunk_516674
rust_dataset.txt
516,674
512
0, 0, "ab"); }); assert_eq!(buffer.cluster_count(), 0); assert_eq!(buffer.text_at(0, 2), " "); } #[test] fn a_cluster_reference_missing_from_the_record_reads_as_a_blank() { let mut buffer = ScreenBuffer::new(1, 4); let mut builder = FrameBuilder::new(4, 1, 0); ...
rust_dataset_chunk_516675
rust_dataset.txt
516,675
512
) -> Self { Self { head: (row, col), ..self } } pub fn is_empty(&self) -> bool { self.anchor == self.head } fn ordered(&self) -> ((usize, usize), (usize, usize)) { if self.anchor <= self.head { (self.anchor, self.head) } else ...
rust_dataset_chunk_516676
rust_dataset.txt
516,676
512
_row_takes_the_cells_between_its_ends() { let state = screen(|p| p.text(0, 0, "hello world")); let selection = Selection::at(0, 2).extended_to(0, 6); assert_eq!(selection.text(state.screen()), "llo w"); } #[test] fn a_selection_dragged_backwards_reads_the_same_as_forwards() { ...
rust_dataset_chunk_516677
rust_dataset.txt
516,677
512
selection = Selection::at(0, 5).extended_to(2, 1); assert!(!selection.covers(0, 4)); assert!(selection.covers(0, 5)); assert!(selection.covers(0, 9)); assert!(selection.covers(1, 0)); assert!(selection.covers(2, 1)); assert!(!selection.covers(2, 2)); assert_eq!(s...
rust_dataset_chunk_516678
rust_dataset.txt
516,678
512
_to(0, 7).text(state.screen()), format!("a{}b", FAMILY_TEXT) ); } #[test] fn a_selection_edge_inside_a_group_takes_the_whole_group() { let state = screen(|p| { p.text(0, 0, "a"); p.group(0, 1, &FAMILY); p.text(0, 7, "b"); }); a...
rust_dataset_chunk_516679
rust_dataset.txt
516,679
512
3]; 16] = [ [0, 0, 0], [20, 20, 80], [80, 13, 13], [20, 80, 20], [80, 20, 80], [20, 80, 80], [80, 80, 20], [53, 53, 53], [26, 26, 26], [33, 33, 60], [60, 26, 26], [33, 60, 33], [60, 33, 60], [33, 60, 60], [60, 60, 33], [80, 80, 80], ]; #[derive(Debug, Cl...
rust_dataset_chunk_516680
rust_dataset.txt
516,680
512
); PixelRect { x, y: (self.line as u32).saturating_mul(cell.height), width: right.saturating_sub(x), height: cell.height, } } } #[derive(Debug, Clone)] pub struct Chunk { pub id: u64, pub cell_x: usize, pub cell_y: usize, pub width: u3...
rust_dataset_chunk_516681
rust_dataset.txt
516,681
512
_cell_size(&mut self, cell: CellSize) { if cell == self.cell { return; } self.cell = cell; self.clear(); } #[cfg(test)] pub fn is_empty(&self) -> bool { self.chunks.is_empty() && self.pending.is_empty() } pub fn chunks(&self) -> impl Iterator<Ite...
rust_dataset_chunk_516682
rust_dataset.txt
516,682
512
overlap) = origin.intersection(&rect) else { return true; }; revisions += 1; chunk.erase(overlap, origin, revisions); chunk.painted > 0 }); if revisions != self.revisions { self.stamp += 1; } self.revisions = rev...
rust_dataset_chunk_516683
rust_dataset.txt
516,683
512
self.data(byte, 1), SixelEvent::Repeat { repeat_count, byte_to_repeat, } => self.data(byte_to_repeat, repeat_count.min(MAX_REPEAT)), SixelEvent::GotoBeginningOfLine => self.x = 0, SixelEvent::GotoNextLine => { self.x = 0; ...
rust_dataset_chunk_516684
rust_dataset.txt
516,684
512
self.declared { if x >= width || y >= height { return; } } while self.rows.len() <= y { self.rows.push(Vec::new()); } let row = &mut self.rows[y]; if row.len() <= x { row.resize(x + 1, self.background); } ...
rust_dataset_chunk_516685
rust_dataset.txt
516,685
512
u8 { ((value.min(100) * 255 + 50) / 100) as u8 } fn hls_to_rgb(hue: usize, lightness: usize, saturation: usize) -> [u8; 3] { let hue = ((hue % 360) + 240) % 360; let lightness = lightness.min(100) as f32 / 100.0; let saturation = saturation.min(100) as f32 / 100.0; let chroma = (1.0 - (2.0 * ligh...
rust_dataset_chunk_516686
rust_dataset.txt
516,686
512
= [0u8; 4]; pixel.copy_from_slice(&image.pixels[start..start + 4]); pixel } #[test] fn a_raster_attribute_sizes_the_canvas() { let image = decode(&sixel("\"1;1;4;12#0;2;100;0;0@")).unwrap(); assert_eq!((image.width, image.height), (4, 12)); assert_eq!(image.pixels.l...
rust_dataset_chunk_516687
rust_dataset.txt
516,687
512
riage_return_paints_a_second_color_over_the_same_band() { let image = decode(&sixel("\"1;1;2;6#0;2;100;0;0@@$#1;2;0;0;100?@")).unwrap(); assert_eq!(pixel(&image, 0, 0), [255, 0, 0, 255]); assert_eq!(pixel(&image, 1, 0), [0, 0, 255, 255]); } #[test] fn a_new_line_advances_by_one_band...
rust_dataset_chunk_516688
rust_dataset.txt
516,688
512
image = decode(&sixel("\"1;1;1;6#7;2;50;25;0@")).unwrap(); assert_eq!(pixel(&image, 0, 0), [128, 64, 0, 255]); } #[test] fn an_hls_register_is_converted_with_the_dec_hue_origin() { let blue = decode(&sixel("\"1;1;1;6#1;1;0;50;100@")).unwrap(); assert_eq!(pixel(&blue, 0, 0), [0, 0, ...
rust_dataset_chunk_516689
rust_dataset.txt
516,689
512
255]); } #[test] fn data_beyond_a_declared_raster_is_clipped_rather_than_growing_it() { let image = decode(&sixel("\"1;1;2;6#0;2;100;0;0!8@--#0;2;100;0;0@")).unwrap(); assert_eq!((image.width, image.height), (2, 6)); } #[test] fn an_oversized_raster_attribute_is_refused() { ...
rust_dataset_chunk_516690
rust_dataset.txt
516,690
512
").is_none()); } #[test] fn a_malformed_payload_is_refused_rather_than_panicking() { for payload in [ &b"\x1bP0;1;0q#not a register@\x1b\\"[..], &b"\x1bP99999999;1;0q@\x1b\\"[..], &b"\x1bP0;1;0q\"1;1;;;;;#\x1b\\"[..], &b"\x1bP0;1;0q\xff\xfe\x1b\\"[..]...
rust_dataset_chunk_516691
rust_dataset.txt
516,691
512
store(); place(&mut store, 0, 0, &band(16, 4)); place(&mut store, 0, 0, &band(16, 4)); assert_eq!(store.chunks().count(), 1); } #[test] fn a_chunk_that_covers_part_of_an_older_one_erases_only_that_part() { let mut store = store(); place(&mut store, 0, 0, &band(16, 7...
rust_dataset_chunk_516692
rust_dataset.txt
516,692
512
0, 0]); assert_eq!(pixel(&chunk.image, 0, 40), [255, 0, 0, 255]); } #[test] fn a_line_outside_the_chunk_leaves_it_alone() { let mut store = store(); place(&mut store, 0, 0, &band(16, 3)); let revision = store.chunks().next().unwrap().revision; store.cut_spans(&[Span:...
rust_dataset_chunk_516693
rust_dataset.txt
516,693
512
::new(8, 20)); assert_eq!(store.chunks().count(), 1); store.set_cell_size(CellSize::new(16, 40)); assert!(store.is_empty()); } #[test] fn a_clear_drops_committed_and_pending_chunks_alike() { let mut store = store(); place(&mut store, 0, 0, &band(16, 1)); stor...
rust_dataset_chunk_516694
rust_dataset.txt
516,694
512
enum FrameError { Undecodable(DecodeError), Unapplicable { seq: u64, error: ApplyError }, } impl std::fmt::Display for FrameError { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self { FrameError::Undecodable(e) => write!(f, "{}", e), FrameError...
rust_dataset_chunk_516695
rust_dataset.txt
516,695
512
} fn assembled(title: String, body: String) -> Option<Notification> { match (title.is_empty(), body.is_empty()) { (true, true) => None, (false, true) => Some(Notification { title: None, body: title, }), (true, false) => Some(Notification { title: None, body }...
rust_dataset_chunk_516696
rust_dataset.txt
516,696
512
Error> { self.apply_frame_with(frame, |_, _| {}) } pub fn apply_frame_with( &mut self, frame: &[u8], before: impl FnOnce(&TerminalState, &structured_render::FrameView<'_>), ) -> Result<FrameApplied, FrameError> { let view = structured_render::decode(frame).map_err(Fr...
rust_dataset_chunk_516697
rust_dataset.txt
516,697
512
File if !self.shared_media => { report!("refusing image {} carried in a local file", id); None }, GraphicsMedium::SharedFile => match std::str::from_utf8(data) { Ok(path) => kitty::read_sh...
rust_dataset_chunk_516698
rust_dataset.txt
516,698
512
== [0x07] { self.signals.bells += 1; } }, Kind::Signal(signal) => match signal { OscSignal::Notification(chunk) => { if let Some(notification) = self.assembly.feed(chunk) { ...
rust_dataset_chunk_516699
rust_dataset.txt
516,699
512
}) .collect() } fn frame_of(cols: u16, rows: u16, seq: u64, sideband: &[u8]) -> Vec<u8> { let mut builder = FrameBuilder::new(cols, rows, seq); builder.sideband_mut().extend_from_slice(sideband); builder.finish() } fn sixel_image(width: usize, bands: usi...