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_517100
rust_dataset.txt
517,100
512
}); }); assert!( state .dump() .contains("cursor: row=0 col=1 hidden shape=Underline blinking"), "{}", state.dump() ); } #[test] fn adjacent_cells_sharing_a_style_collapse_into_one_run() { let state = state...
rust_dataset_chunk_517101
rust_dataset.txt
517,101
512
test] fn a_wide_character_is_reported_with_its_spacer() { let state = state_of(1, 4, |builder| { builder.push_row( 0, 0, &[ WireCell { ch: '\u{4f60}' as u32, width: 2, ...
rust_dataset_chunk_517102
rust_dataset.txt
517,102
512
UNDERLINE_DOUBLE, UNDERLINE_STRAIGHT, }; use crate::emulation::screen_buffer::{Occupancy as BufferOccupancy, ScreenBuffer}; use crate::testing::projection::{Cell, Cursor, Occupancy, Projection, DEFAULT_COLOR}; use crate::testing::reference::Emitter; const NAMED_COLORS: [&str; 16] = [ "black", "red", "gre...
rust_dataset_chunk_517103
rust_dataset.txt
517,103
512
attrs.insert(name); } } let underline = match cell.underline_style() { UNDERLINE_STRAIGHT => Some("underline"), UNDERLINE_DOUBLE => Some("double-underline"), UNDERLINE_CURLY => Some("undercurl"), UNDERLINE_DOTTED =>...
rust_dataset_chunk_517104
rust_dataset.txt
517,104
512
&mut dialects); } take(&mut emitter, &mut dialects); dialects } pub fn grid_and_wire( bytes: &[u8], rows: usize, cols: usize, chunk: usize, ) -> (Projection, Projection) { let (grid, buffer) = grid_and_buffer(bytes, rows, cols, chunk); (grid, project_screen_buffer(&buffer)) } pub ...
rust_dataset_chunk_517105
rust_dataset.txt
517,105
512
} #[cfg(test)] mod tests { use super::*; use crate::testing::differential::{reference_of, stream_corpus, STREAM_COLS, STREAM_ROWS}; use crate::testing::projection::compare; use std::fs; const EMIT_CHUNK: usize = 4096; fn divergences_for(bytes: &[u8]) -> Vec<String> { if crate::testin...
rust_dataset_chunk_517106
rust_dataset.txt
517,106
512
1b[5mh\x1b[6mi"); } #[test] fn every_styled_underline_agrees_across_the_dialects() { assert_agrees( b"\x1b[4:1ma\x1b[4:2mb\x1b[4:3mc\x1b[4:4md\x1b[4:5me\ \x1b[58:2::1:2:3mf\x1b[58:5:208mg\x1b[59mh", ); } #[test] fn wide_characters_agree_on_both_of_thei...
rust_dataset_chunk_517107
rust_dataset.txt
517,107
512
a} x\u{ad}y \u{ff76}\u{ff9e}".as_bytes()); } #[test] fn emoji_sequences_agree_across_the_dialects_in_default_mode() { assert_agrees( "\u{26a0}\u{fe0f}|\u{1f44d}\u{1f3fd}|\u{1f1e9}\u{1f1ea}|\ \u{1f468}\u{200d}\u{1f469}\u{200d}\u{1f467}|\u{1f3f3}\u{fe0f}\u{200d}\u{1f308}|\ ...
rust_dataset_chunk_517108
rust_dataset.txt
517,108
512
u{1f1eb}|"; let (grid, wire) = grid_and_wire(stream.as_bytes(), STREAM_ROWS, STREAM_COLS, EMIT_CHUNK); let divergences: Vec<String> = compare(&grid, &wire) .into_iter() .map(|divergence| divergence.describe()) .collect(); assert!(divergences.is_empty(), "{}", ...
rust_dataset_chunk_517109
rust_dataset.txt
517,109
512
, Clone, PartialEq)] pub struct Message { pub ts_us: u64, pub msg: ServerToClientMsg, } #[derive(Serialize, Deserialize, Debug, Clone, PartialEq)] #[serde(tag = "kind", rename_all = "snake_case")] pub enum Record { Header(Header), Message(Message), } #[derive(Debug, Clone, PartialEq)] pub struct Fixtu...
rust_dataset_chunk_517110
rust_dataset.txt
517,110
512
fixture::{MessageRef, RecordRef}; fn header_line(format_version: u32, contract_version: usize) -> String { serde_json::to_string(&Record::Header(Header { format_version, contract_version, session: "window-test".to_owned(), rows: 40, cols: 120, ...
rust_dataset_chunk_517111
rust_dataset.txt
517,111
512
n{}\n", header_line(FIXTURE_FORMAT_VERSION, CLIENT_SERVER_CONTRACT_VERSION + 1), render_line("still readable") ); assert_eq!(parse_str(&text).unwrap().messages.len(), 1); } #[test] fn a_headerless_or_undecodable_fixture_is_refused() { assert!(parse_str(&forma...
rust_dataset_chunk_517112
rust_dataset.txt
517,112
512
pub fn stream_golden_path(stream: &Path, extension: &str) -> PathBuf { stream_goldens_dir().join(format!( "{}.{}", stream .file_name() .map(|name| name.to_string_lossy().into_owned()) .unwrap_or_else(|| "unnamed".to_owned()), extension )) } fn stem_of...
rust_dataset_chunk_517113
rust_dataset.txt
517,113
512
", &["\\\\\\\\"]), ("stream/git_diff_scrollup", &["*", "::"]), ("stream/grid_copy_wrapped", &["!?"]), ("stream/htop", &["|||||", "||||||", "|||||||", "|||||||||||||||||||||||||||||||||||||"]), ("stream/htop_right_scrolling", &["//", "|||||||", "|||||||||", "||||||||||", "||||||||||||||||...
rust_dataset_chunk_517114
rust_dataset.txt
517,114
512
{}, } } } assert!( unusable.is_empty(), "the fixture corpus is not readable by this build; re-record it with \ fixtures/capture.sh: {}", unusable.join(", ") ); } fn shaping_cache() -> GlyphCache { Glyp...
rust_dataset_chunk_517115
rust_dataset.txt
517,115
512
mut crate::testing::headless::GpuLease, ligatures: bool) -> Image { let mut cache = GlyphCache::new( FontStack::build(&crate::text::font::FontOptions { family: None, size: DEFAULT_FONT_SIZE, system_fonts: false, ligatures, ...
rust_dataset_chunk_517116
rust_dataset.txt
517,116
512
let _ = scene::test_helpers::build(&state, &mut cache); } assert_eq!( cache.shaped_runs(), 0, "the shaper was consulted with ligatures off" ); } #[test] #[ignore] fn print_the_ligating_goldens_as_a_table() { for (name, sequences) in l...
rust_dataset_chunk_517117
rust_dataset.txt
517,117
512
fixture, golden )); continue; }, }; if expected != dumped { failures.push(format!( "{:?} diverges from {:?} at {}; regenerate with UPDATE_GOLDENS=1", fixture, ...
rust_dataset_chunk_517118
rust_dataset.txt
517,118
512
play_file(subject).unwrap(); let headless = gpu.get(); let mut cold = GlyphCache::new(FontStack::embedded(DEFAULT_FONT_SIZE).unwrap()); let built = scene::test_helpers::build(&outcome.state, &mut cold); let from_cold = headless.render(&built, cold.atlases()).unwrap(); let mut f...
rust_dataset_chunk_517119
rust_dataset.txt
517,119
512
(difference) = compare(&expected, &rendered) { failures.push(format!( "{:?} diverges from {:?} at {}; regenerate with UPDATE_GOLDENS=1", fixture, golden, difference )); } } assert!(failures.is_empty(), "{}", failures.jo...
rust_dataset_chunk_517120
rust_dataset.txt
517,120
512
write(&golden, &rendered).unwrap(); continue; } match image_io::test_helpers::read(&golden) { Ok(expected) => { if let Some(difference) = compare(&expected, &rendered) { failures.push(format!( ...
rust_dataset_chunk_517121
rust_dataset.txt
517,121
512
(|pixel| pixel == expected), "the rgb image carries no {:?} band", expected ); } } const HIDPI_FIXTURE: &str = "glyph-torture"; const HIDPI_SCALE: f32 = 2.0; #[test] fn the_torture_fixture_renders_at_a_doubled_font_size() { let Some(mut g...
rust_dataset_chunk_517122
rust_dataset.txt
517,122
512
.iter() .zip(actual) .any(|(a, b)| a.abs_diff(*b) > CHANNEL_TOLERANCE) }) } fn compare(expected: &Image, actual: &Image) -> Option<String> { if expected.width != actual.width || expected.height != actual.height { ...
rust_dataset_chunk_517123
rust_dataset.txt
517,123
512
_some()); } #[test] fn a_size_change_is_reported_rather_than_compared() { let golden = Image { width: 1, height: 1, pixels: vec![0, 0, 0, 255], }; let rendered = Image { width: 2, height: 1, pixels: vec![0, 0, 0...
rust_dataset_chunk_517124
rust_dataset.txt
517,124
512
::On, paints: &Paints::default(), cursor: CursorOptions::default(), hovered_link: None, preedit: None, }, cache, ); } fn whole(state: &TerminalState, cache: &mut GlyphCache) -> Re...
rust_dataset_chunk_517125
rust_dataset.txt
517,125
512
.get(); let mut failures = Vec::new(); for stream in differential::stream_corpus().unwrap() { let state = stream_state(&stream); let retained = whole(&state, &mut cache); let rendered = headless .render_retained(&retained, cach...
rust_dataset_chunk_517126
rust_dataset.txt
517,126
512
headless: &mut Headless, rows: usize, cols: usize, cell: (u32, u32), frames: &[Vec<u8>], ) -> Vec<u64> { rebuilt_images(headless, rows, cols, cell, frames, |_, image| { fingerprint(&image) }) } fn rebuilt_i...
rust_dataset_chunk_517127
rust_dataset.txt
517,127
512
{}-rebuilt.png", stem)); let _ = image_io::test_helpers::write(&held_path, &held); let _ = image_io::test_helpers::write(&built_path, &built); let differing: Vec<usize> = held .pixels .chunks_exact(4) .zip(built.pixels.chunks_exact(4)) ...
rust_dataset_chunk_517128
rust_dataset.txt
517,128
512
().unwrap() { let (rows, cols, cell, frames) = frames_of(&fixture); let first_difference = first_differing_frame(headless, rows, cols, cell, &frames) .and_then(|_| first_differing_frame(headless, rows, cols, cell, &frames)); if let Some(index) = first_...
rust_dataset_chunk_517129
rust_dataset.txt
517,129
512
headless: &mut Headless, padding_color: zellij_utils::input::terminal::PaddingColor, ) -> Image { use crate::render::renderer::Frame; use crate::render::scene::{padding_rects, Margins, Transparency}; use crate::text::font::{CellAdjust, FontOptions}; u...
rust_dataset_chunk_517130
rust_dataset.txt
517,130
512
ases(), target, Frame { origin: fit.origin, margins: &margins, layer: None, }, ) .unwrap() } #[test] fn a_padded_taller_cell_render...
rust_dataset_chunk_517131
rust_dataset.txt
517,131
512
_io::test_helpers::write(&golden, &rendered).unwrap(); return; } let expected = image_io::test_helpers::read(&golden).unwrap_or_else(|_| { panic!( "{:?} has no golden; regenerate with UPDATE_GOLDENS=1", golden ...
rust_dataset_chunk_517132
rust_dataset.txt
517,132
512
(|x| pixel(&plain, x, y) == pixel(&padded, x + left, y + top)) }); if !shifted { failures.push(format!( "{:?}: the padded grid is not the plain grid moved", fixture )); } ...
rust_dataset_chunk_517133
rust_dataset.txt
517,133
512
)) } #[cfg(not(target_os = "linux"))] fn load_egl_library() -> Result<libloading::Library> { Err(anyhow!( "headless rendering is implemented for Linux only: it loads libEGL.so.1 by soname and \ drives a surfaceless EGL display, neither of which has a counterpart wired up for \ this platfo...
rust_dataset_chunk_517134
rust_dataset.txt
517,134
512
let library = load_egl_library()?; let egl = unsafe { Egl::load_required_from(library) } .map_err(|e| anyhow!("failed to load EGL entry points: {}", e))?; let display = surfaceless_display(&egl)?; egl.initialize(display) .context("failed to initialize the surface...
rust_dataset_chunk_517135
rust_dataset.txt
517,135
512
-> Result<()> { if width == 0 || height == 0 { return Err(anyhow!("cannot render a {}x{} scene", width, height)); } if width > MAX_TARGET_SIDE || height > MAX_TARGET_SIDE { return Err(anyhow!( "scene of {}x{} exceeds the {} px render target limit", ...
rust_dataset_chunk_517136
rust_dataset.txt
517,136
512
} fn read_back(&mut self, width: u32, height: u32) -> Image { let len = (width * height * 4) as usize; if self.scratch.len() < len { self.scratch.resize(len, 0); } let read_back = *self .read_back .get_or_insert_with(|| preferred_read_back(self.r...
rust_dataset_chunk_517137
rust_dataset.txt
517,137
512
() -> bool { static AVAILABLE: std::sync::OnceLock<bool> = std::sync::OnceLock::new(); *AVAILABLE.get_or_init(|| { if std::env::var_os(SKIP_ENV).is_some() { eprintln!( "zellij-terminal: {} is set, skipping the render tests", SKIP_ENV ...
rust_dataset_chunk_517138
rust_dataset.txt
517,138
512
.context("failed to bind the render context to this thread") } fn release_current(&self) { let _ = self.egl.make_current(self.display, None, None, None); } pub fn image_textures(&self) -> usize { self.renderer.image_textures() } pub fn read_the_next_frame_as_bgra(&mut self) {...
rust_dataset_chunk_517139
rust_dataset.txt
517,139
512
( gl.get_parameter_i32(glow::IMPLEMENTATION_COLOR_READ_FORMAT) as u32, gl.get_parameter_i32(glow::IMPLEMENTATION_COLOR_READ_TYPE) as u32, ) }; if format == glow::BGRA && kind == glow::UNSIGNED_BYTE { ReadBack::Bgra } else { ReadBack::Rgba } } fn s...
rust_dataset_chunk_517140
rust_dataset.txt
517,140
512
|painter| painter.graphics(records)); } fn draw(gpu: &mut GpuLease, state: &TerminalState) -> (Image, crate::text::font::CellMetrics) { let mut cache = GlyphCache::new(FontStack::embedded(DEFAULT_FONT_SIZE).unwrap()); let built = scene::test_helpers::build(state, &mut cache); let metri...
rust_dataset_chunk_517141
rust_dataset.txt
517,141
512
Stack::embedded(DEFAULT_FONT_SIZE).unwrap()); let built = scene::test_helpers::build(&state, &mut first); gpu.get().render(&built, first.atlases()).unwrap(); let zoomed = FontStack::embedded(DEFAULT_FONT_SIZE * 1.1).unwrap(); let mut second = GlyphCache::new(zoomed); let built =...
rust_dataset_chunk_517142
rust_dataset.txt
517,142
512
0, 0, "MMMM", background(1)); painter.styled(1, 0, "MMMM", background(1)); }); let mut cache = GlyphCache::new(FontStack::embedded(DEFAULT_FONT_SIZE).unwrap()); let metrics = cache.metrics(); let mut retained = crate::render::retained::RetainedScene::new(); retained.r...
rust_dataset_chunk_517143
rust_dataset.txt
517,143
512
, target.1 / 2), border, "the line is two pixels wide" ); for y in margin..margin + grid_height { for x in margin..margin + grid_width { assert_ne!( image.pixel(x, y), border, "the border reac...
rust_dataset_chunk_517144
rust_dataset.txt
517,144
512
..metrics.height).any(|y| { (0..metrics.width) .any(|x| image.pixel(cell * metrics.width + x, y) != [0, 0, 0, 255]) }) }; assert!(lit(0), "the glyph cell is blank"); assert!(!lit(1), "the glyph bled into the next cell"); } #[test] fn t...
rust_dataset_chunk_517145
rust_dataset.txt
517,145
512
4, |painter| { painter.styled(0, 0, "M", |cell| cell.fg = WireColor::Named(1).pack()); }), ); let [red, green, blue] = color::ANSI_16[1]; let lit = (0..metrics.height) .flat_map(|y| (0..metrics.width).map(move |x| (x, y))) .map(|(x, y)| image.p...
rust_dataset_chunk_517146
rust_dataset.txt
517,146
512
Place::of(1, 8, 20).cropped(0, 0, 4, 6).record(), ], |_| {}, ); let (image, _) = draw(&mut gpu, &state); assert_eq!(image.pixel(3, 5), [0, 0, 255, 255]); assert_eq!( image.pixel(4, 5), [ color::DEFAULT_BACKGR...
rust_dataset_chunk_517147
rust_dataset.txt
517,147
512
state, &[GraphicsRecord::DeleteImage { id: 1 }]); let cleared = headless .render( &scene::test_helpers::build(&state, &mut cache), cache.atlases(), ) .unwrap(); let [r, g, b] = color::DEFAULT_BACKGROUND; assert_eq!(cleared.pixe...
rust_dataset_chunk_517148
rust_dataset.txt
517,148
512
{}, ); headless .render( &scene::test_helpers::build(&state, &mut cache), cache.atlases(), ) .unwrap(); assert_eq!(headless.image_textures(), 1); Painter::apply(&mut state, |painter| painter.full_repaint()); he...
rust_dataset_chunk_517149
rust_dataset.txt
517,149
512
stream.push_str("\u{1b}\\"); stream } fn sixel_state( rows: usize, cols: usize, records: &[GraphicsRecord], paint: impl FnOnce(&mut Painter), ) -> TerminalState { let mut state = TerminalState::new(rows, cols); state.set_cell_size(8, 20); Pai...
rust_dataset_chunk_517150
rust_dataset.txt
517,150
512
(0, 0, "MM", background(1)), ); let image = headless .render( &scene::test_helpers::build(&state, &mut cache), cache.atlases(), ) .unwrap(); assert_eq!(image.pixel(0, 0), [0, 255, 0, 255]); } #[test] fn a_kitty_imag...
rust_dataset_chunk_517151
rust_dataset.txt
517,151
512
let cleared = headless .render( &scene::test_helpers::build(&state, &mut cache), cache.atlases(), ) .unwrap(); assert_eq!(headless.image_textures(), 0); assert_ne!(cleared.pixel(0, 0), [0, 255, 0, 255]); } #[test] f...
rust_dataset_chunk_517152
rust_dataset.txt
517,152
512
paint)); assert_eq!(first, second); } #[test] fn composing_text_is_drawn_over_cells_the_pane_still_owns() { let Some(mut gpu) = Headless::exclusive() else { return; }; let mut cache = GlyphCache::new(FontStack::embedded(DEFAULT_FONT_SIZE).unwrap()); let ...
rust_dataset_chunk_517153
rust_dataset.txt
517,153
512
will occupy starts empty" ); assert!( cell(&after, 2) > 0 && cell(&after, 3) > 0, "the composing text was not drawn at the cursor" ); assert_eq!( cell(&after, 4), (metrics.width * metrics.height) as usize, "the cursor did not m...
rust_dataset_chunk_517154
rust_dataset.txt
517,154
512
::new(); retained.set_transparency(transparency); retained.refresh( SceneInputs { state: state, phase: scene::BlinkPhase::On, paints: &see_through_paints(), cursor: scene::CursorOptions::default(), hovered_link: ...
rust_dataset_chunk_517155
rust_dataset.txt
517,155
512
_see_through_background_lets_only_the_default_background_through() { let Some(mut gpu) = Headless::exclusive() else { return; }; let (image, metrics) = render_see_through( &mut gpu, &see_through_state(), see_through(0.8, zellij_utils::input::termin...
rust_dataset_chunk_517156
rust_dataset.txt
517,156
512
8), "the block cursor", ); assert_near(pixel(at.image), scaled([10, 200, 30], 0.8), "the image"); } #[test] fn full_opacity_in_either_mode_draws_what_a_solid_window_draws() { let Some(mut gpu) = Headless::exclusive() else { return; }; let stat...
rust_dataset_chunk_517157
rust_dataset.txt
517,157
512
; }; let mut cache = GlyphCache::new(FontStack::embedded(DEFAULT_FONT_SIZE).unwrap()); let headless = gpu.get(); let small = painted(2, 2, |painter| painter.text(0, 0, "ab")); let small_scene = scene::test_helpers::build(&small, &mut cache); let small_image = headless.re...
rust_dataset_chunk_517158
rust_dataset.txt
517,158
512
( &mut gpu, &painted(1, 6, |painter| painter.cluster(0, 0, "\u{26a0}\u{fe0f}", 2)), ); assert!(coloured_pixels(&image, metrics, 2) > 20); let inked = inked_columns(&image, metrics, 0, 6); assert!( !inked.is_empty() && inked.iter().all(|col| *col < 2), ...
rust_dataset_chunk_517159
rust_dataset.txt
517,159
512
inked.iter().all(|col| *col < 2), "{:?}", inked ); } #[test] fn a_devanagari_conjunct_is_drawn_inside_its_two_columns() { let Some(mut gpu) = Headless::exclusive() else { return; }; let mut cache = GlyphCache::new(FontStack::new(DEFAULT_F...
rust_dataset_chunk_517160
rust_dataset.txt
517,160
512
metrics.height).find(|y| (0..metrics.width).any(|x| image.pixel(x, *y) != blank)) }; assert!( top_ink(&accented) < top_ink(&plain), "the accent does not reach above the letter" ); } #[test] fn a_text_style_warning_sign_stays_in_its_one_column() { let ...
rust_dataset_chunk_517161
rust_dataset.txt
517,161
512
_FORMAT_RGBA8, }; pub fn link_record(links: &[(u8, &str)]) -> LinkRecord { LinkRecord { entries: links .iter() .map(|(id, uri)| LinkEntry { id: *id, uri: (*uri).to_owned(), }) .collect(), } } pub fn linked_frame( rows:...
rust_dataset_chunk_517162
rust_dataset.txt
517,162
512
offset_x: u32, offset_y: u32, source_x: u32, source_y: u32, source_width: u32, source_height: u32, z: i32, } impl Place { pub fn of(image_id: u64, width: u32, height: u32) -> Self { Self { image_id, placement_id: 1, cell_x: 0, cell_y:...
rust_dataset_chunk_517163
rust_dataset.txt
517,163
512
, paint: impl FnOnce(&mut Painter)) { Self::applied(state, paint); } pub fn applied( state: &mut TerminalState, paint: impl FnOnce(&mut Painter), ) -> crate::emulation::terminal::FrameApplied { let size = state.size(); let frame = Self::frame(size.rows, size.cols, pa...
rust_dataset_chunk_517164
rust_dataset.txt
517,164
512
mut cell); cell }) .collect(); self.builder.push_row(row as u16, col as u16, &cells); } pub fn wide(&mut self, row: usize, col: usize, character: char) { self.wide_styled(row, col, character, |_| {}); } pub fn wide_styled( &mut self, ...
rust_dataset_chunk_517165
rust_dataset.txt
517,165
512
text.chars(); let ch = match (characters.next(), characters.next()) { (Some(only), None) => only as u32, (Some(first), Some(_)) => self.builder.cluster(text).unwrap_or(first as u32), _ => ' ' as u32, }; let mut head = WireCell { ...
rust_dataset_chunk_517166
rust_dataset.txt
517,166
512
link, VteTerminal}; pub const DEFAULT_COLOR: &str = "default"; #[derive(Clone, Copy, PartialEq, Eq, Debug)] pub enum Occupancy { Single, WideHead, WideTail, LeadingSpacer, } #[derive(Clone, PartialEq, Eq, Debug)] pub struct Cell { pub text: String, pub occupancy: Occupancy, pub fg: String...
rust_dataset_chunk_517167
rust_dataset.txt
517,167
512
actual: format!("{}x{}", actual.rows, actual.cols), }); return divergences; } if let (Some(expected), Some(found)) = (reference.cursor.position, actual.cursor.position) { if expected != found { divergences.push(Divergence { what: "cursor position"...
rust_dataset_chunk_517168
rust_dataset.txt
517,168
512
: None, }, cells, wrapped_rows: Vec::new(), }) } pub fn of_window(state: &VteTerminal) -> Projection { let size = state.size(); let grid = state.term().grid(); let mut cells = Vec::with_capacity(size.rows); let mut wrapped_rows = Vec::new(); for row in 0..size.rows { ...
rust_dataset_chunk_517169
rust_dataset.txt
517,169
512
"undercurl"), (Flags::DOTTED_UNDERLINE, "dotted-underline"), (Flags::DASHED_UNDERLINE, "dashed-underline"), ] { if cell.flags.contains(flag) { attrs.insert(name); } } if blink.slow { attrs.insert("blink-slow"); } if blink.fast { attrs.inse...
rust_dataset_chunk_517170
rust_dataset.txt
517,170
512
md", ); assert_eq!(projection.cells[0][0].fg, "red"); assert_eq!(projection.cells[0][1].fg, "idx208"); assert_eq!(projection.cells[0][2].fg, "#010203"); assert_eq!(projection.cells[0][3].fg, DEFAULT_COLOR); } #[test] fn a_wide_character_occupies_a_head_and_a_tail() {...
rust_dataset_chunk_517171
rust_dataset.txt
517,171
512
_descriptions() { let one = projected(1, 4, "\u{1b}[31ma"); let other = projected(1, 4, "\u{1b}[32ma"); let divergences = compare(&one, &other); assert_eq!(divergences.len(), 1); assert_eq!(divergences[0].what, "cell 0,0"); assert!(divergences[0].reference.contains("fg=re...
rust_dataset_chunk_517172
rust_dataset.txt
517,172
512
::grapheme_join; use zellij_server::panes::grid::Grid; use zellij_server::panes::kitty_graphics::interceptor::{InterceptorResult, KittyApcInterceptor}; use zellij_server::panes::kitty_graphics::store::KittyImageStore; use zellij_server::panes::kitty_graphics::KittyHostCapability; use zellij_server::panes::link_handler:...
rust_dataset_chunk_517173
rust_dataset.txt
517,173
512
grid: &mut Grid, parser: &mut zellij_server::vt_parser::Parser, interceptor: &mut KittyApcInterceptor, bytes: &[u8], ) { let mut forwarded: Vec<u8> = Vec::with_capacity(bytes.len()); for byte in bytes { match interceptor.advance(*byte) { InterceptorResult::Forward(bytes) => forw...
rust_dataset_chunk_517174
rust_dataset.txt
517,174
512
>, pending_signals: Vec<String>, } impl Emitter { pub fn new(rows: usize, cols: usize) -> Self { let stores = Stores::new(); let grid = stores.grid(rows, cols); Self { grid, parser: zellij_server::vt_parser::Parser::new(), interceptor: KittyApcInterce...
rust_dataset_chunk_517175
rust_dataset.txt
517,175
512
)?; let frame = self.serialize_one(true, clear, character_chunks, sixel_chunks, kitty_chunks)?; self.pending_signals.clear(); Some((ansi, frame)) } fn serialize_one( &mut self, structured: bool, clear: bool, character_chunks: Vec<CharacterChu...
rust_dataset_chunk_517176
rust_dataset.txt
517,176
512
shape_csi); if visible { output.add_post_vte_instruction_to_client(CLIENT, "\u{1b}[?25h"); output.add_post_vte_instruction_to_client( CLIENT, &format!("\u{1b}[{};{}H\u{1b}[m", y + 1, x + 1), ); ...
rust_dataset_chunk_517177
rust_dataset.txt
517,177
512
: None, }, }; Projection { rows, cols, cursor, cells, wrapped_rows: Vec::new(), } } #[derive(Clone, Copy, Default)] struct PaneDefaults { foreground: Option<(u8, u8, u8)>, background: Option<(u8, u8, u8)>, } fn project_line( line: &[TerminalChar...
rust_dataset_chunk_517178
rust_dataset.txt
517,178
512
underline: None, attrs: BTreeSet::new(), link: None, } } fn resolved(color: String, default: Option<(u8, u8, u8)>) -> String { match (color.as_str(), default) { (DEFAULT_COLOR, Some((r, g, b))) => format!("#{:02x}{:02x}{:02x}", r, g, b), _ => color, } } fn project_characte...
rust_dataset_chunk_517179
rust_dataset.txt
517,179
512
line(Some(AnsiStyledUnderline::Underdotted))) => { Some("dotted-underline") }, Some(AnsiCode::Underline(Some(AnsiStyledUnderline::Underdashed))) => { Some("dashed-underline") }, _ => None, } } fn zellij_color(code: Option<AnsiCode>) -> String { match code...
rust_dataset_chunk_517180
rust_dataset.txt
517,180
512
8, "\u{1b}[1;1H\u{1b}[mhello"); } #[test] fn every_emitted_color_form_agrees() { assert_agrees( 1, 10, "\u{1b}[1;1H\u{1b}[m\u{1b}[31ma\u{1b}[38;5;208mb\u{1b}[38;2;1;2;3mc\ \u{1b}[39m\u{1b}[41md\u{1b}[48;5;99me\u{1b}[48;2;9;8;7mf\u{1b}[49mg", ...
rust_dataset_chunk_517181
rust_dataset.txt
517,181
512
\u{302}\u{1b}[Dx\u{303}", ); } #[test] fn variation_selectors_agree() { assert_agrees( 1, 16, "\u{1b}[1;1H\u{1b}[m\u{26a0}\u{fe0f}|\u{231a}\u{fe0e}|1\u{fe0f}\u{20e3}|", ); } #[test] fn skin_tones_and_flags_agree_cell_by_cell() { ...
rust_dataset_chunk_517182
rust_dataset.txt
517,182
512
reference = Reference::new(2, 30); reference.advance(frame.as_bytes()); let divergences = compare(&emitter.project(), &reference.project()); assert!( divergences.is_empty(), "{}", divergences .iter() .map(|divergence| divergenc...
rust_dataset_chunk_517183
rust_dataset.txt
517,183
512
Vec<_>>() .join("\n") ); } #[test] fn the_emitter_produces_no_frame_when_nothing_changed() { let mut emitter = Emitter::new(4, 20); emitter.advance(b"hello"); assert!(emitter.frame().is_some()); assert!(emitter.frame().is_none()); } } --- FILE: ...
rust_dataset_chunk_517184
rust_dataset.txt
517,184
512
}; fn fixture_of(msgs: Vec<ServerToClientMsg>) -> Fixture { Fixture { header: Header { format_version: FIXTURE_FORMAT_VERSION, contract_version: CLIENT_SERVER_CONTRACT_VERSION, session: "window-test".to_owned(), rows: 3, ...
rust_dataset_chunk_517185
rust_dataset.txt
517,185
512
"ab "); } #[test] fn an_unusable_frame_is_skipped_rather_than_aborting_the_replay() { let outcome = replay(&fixture_of(vec![ ServerToClientMsg::RenderFrame { frame: b"nonsense".to_vec(), }, frame(0, 0, "ab"), ])); assert_eq!(ou...
rust_dataset_chunk_517186
rust_dataset.txt
517,186
512
pub fn expect(&mut self, count: usize) { for _ in 0..count { match self.from_client.try_recv_client_msg() { Ok((msg, _)) => self.received.push(msg), Err(e) => panic!("expected a client message, got {:?}", e), } } } } impl FakeServer { pub...
rust_dataset_chunk_517187
rust_dataset.txt
517,187
512
ClipboardSink { fn send_event(&self, _event: Event) {} } #[derive(Debug, Clone, Copy, Default, PartialEq, Eq)] pub struct Blink { pub slow: bool, pub fast: bool, } #[derive(Default)] struct BlinkMap { rows: usize, cols: usize, cells: Vec<Blink>, } impl BlinkMap { fn sized(rows: usize, co...
rust_dataset_chunk_517188
rust_dataset.txt
517,188
512
Vec::new(); for byte in payload { let step = self.filter.advance(*byte); match step.kind { Kind::Forward => forwarded.extend_from_slice(step.bytes.as_slice()), Kind::Cleared => { forwarded.extend_from_slice(step.bytes.as_slice()); ...
rust_dataset_chunk_517189
rust_dataset.txt
517,189
512
fn cursor_cell(&self) -> (usize, usize) { let cursor = &self.term.grid().cursor; let column = cursor.point.column.0 + usize::from(cursor.input_needs_wrap); ( cursor.point.line.0.max(0) as usize, column.min(self.term.columns()), ) } pub fn resize(&mut ...
rust_dataset_chunk_517190
rust_dataset.txt
517,190
512
_LINES), cols: cols.max(alacritty_terminal::term::MIN_COLUMNS), } } --- FILE: zellij/zellij-terminal/src/text/discovery.rs --- use std::path::PathBuf; use std::sync::{Mutex, OnceLock}; use crate::text::font::FaceRequest; #[cfg(test)] use crate::text::font::FaceStyle; #[cfg_attr(not(any(target_os = "maco...
rust_dataset_chunk_517191
rust_dataset.txt
517,191
512
} } #[cfg(test)] pub fn synthetic(directory: &std::path::Path) -> Option<Self> { Backend::synthetic(directory) .map(|backend| Discovery(Box::leak(Box::new(Mutex::new(backend))))) } } // fontconfig is opened at runtime rather than linked, so the terminal still starts (on its...
rust_dataset_chunk_517192
rust_dataset.txt
517,192
512
const FC_SLANT_ITALIC: c_int = 100; const FAMILY: &[u8] = b"family\0"; const WEIGHT: &[u8] = b"weight\0"; const SLANT: &[u8] = b"slant\0"; const CHARSET: &[u8] = b"charset\0"; const FILE: &[u8] = b"file\0"; const INDEX: &[u8] = b"index\0"; const MONOSPACE: &[u8] = b"monospace\0"; co...
rust_dataset_chunk_517193
rust_dataset.txt
517,193
512
extern "C" fn(*const Pattern, *const c_char, c_int, *mut *mut CharSet) -> c_int, charset_create: unsafe extern "C" fn() -> *mut CharSet, charset_destroy: unsafe extern "C" fn(*mut CharSet), charset_add_char: unsafe extern "C" fn(*mut CharSet, u32) -> c_int, charset_has_char: unsafe exte...
rust_dataset_chunk_517194
rust_dataset.txt
517,194
512
\ falling back to the embedded fonts", e ); return None; }, }; let config = unsafe { (api.init_load_config_and_fonts)() }; if config.is_null() { report!("fontcon...
rust_dataset_chunk_517195
rust_dataset.txt
517,195
512
32)> { let api = &self.api; unsafe { let charset = (api.charset_create)(); if charset.is_null() { return None; } (api.charset_add_char)(charset, character as u32); let pattern = (api.pattern_crea...
rust_dataset_chunk_517196
rust_dataset.txt
517,196
512
, CHARSET.as_ptr() as *const c_char, charset); let found = self.first_choice(pattern); (api.charset_destroy)(charset); found } } #[cfg(test)] unsafe fn first_choice(&self, pattern: *mut Pattern) -> Option<PathBuf> { let api...
rust_dataset_chunk_517197
rust_dataset.txt
517,197
512
None } else { accept(matched).filter(|(path, _)| is_sfnt(path)) }; if !matched.is_null() { (api.pattern_destroy)(matched); } if found.is_some() { return found; ...
rust_dataset_chunk_517198
rust_dataset.txt
517,198
512
_set_destroy)(listed); } (api.object_set_destroy)(objects); (api.pattern_destroy)(pattern); } super::scan::sort_families(&mut families); families } unsafe fn answers_to(&self, matched: *mut Pattern, requested: &str) -> ...
rust_dataset_chunk_517199
rust_dataset.txt
517,199
512
Some((PathBuf::from(path), face_index(index))) } } /// fontconfig packs a variable font's named instance into the upper 16 /// bits of FC_INDEX (`instance << 16 | face`). Only the lower 16 bits /// address a face in the file; the weight is applied separately through /// the variation axes,...