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_516900
rust_dataset.txt
516,900
512
aves_no_ink() { use zellij_utils::structured_render::{ WireColor, ATTR_HIDDEN, UNDERLINE_SHIFT, UNDERLINE_STRAIGHT, }; let mut cache = cache(); let state = Painter::state(2, 8, |painter| { painter.styled(0, 0, "MM", |cell| { cell.attrs |= ATTR_HIDDEN | (UNDERLINE_STRAIGHT << ...
rust_dataset_chunk_516901
rust_dataset.txt
516,901
512
fn a_graphics_state_that_has_not_moved_keeps_the_image_list_it_emitted() { let mut cache = cache(); let state = with_an_image(1); let mut retained = RetainedScene::new(); refreshed(&mut retained, &state, &mut cache); assert!(retained.replaced_images()); assert_eq!(retained.images().len(), 1); ...
rust_dataset_chunk_516902
rust_dataset.txt
516,902
512
, ATTR_STRIKE, UNDERLINE_CURLY, UNDERLINE_DASHED, UNDERLINE_DOTTED, UNDERLINE_DOUBLE, UNDERLINE_STRAIGHT, }; pub(super) fn push_decorations( out: &mut RowScene, context: &RowContext<'_>, cell: WireCell, paint: &CellPaint, (origin_x, origin_y): (i32, i32), inkless: bool, ) { let (metrics...
rust_dataset_chunk_516903
rust_dataset.txt
516,903
512
}, UNDERLINE_DASHED => { let dash = (metrics.width / 2).max(2 * stroke); for (x, phase) in columns(origin_x, metrics.width, dash * 2) { if phase < dash { line(underline_y, x, 1, stroke); } } }, UNDERLINE_CUR...
rust_dataset_chunk_516904
rust_dataset.txt
516,904
512
origin_y: i32, metrics: CellMetrics, color: Srgb, ) { let stroke = metrics.stroke.max(1).min(metrics.width).min(metrics.height); let (width, height) = (metrics.width, metrics.height); for (x, y, w, h) in [ (0, 0, width, stroke), (0, (height - stroke) as i32, width, stroke), ...
rust_dataset_chunk_516905
rust_dataset.txt
516,905
512
Metrics, spill: u32, ) { let (cell, occupancy, paint) = (entry.cell, entry.occupancy, &entry.paint); let baseline = origin_y + metrics.baseline as i32; let budget = if occupancy == Occupancy::WideHead { (cell.width as u32).clamp(2, 3) } else { 1 }; let character = cell.charac...
rust_dataset_chunk_516906
rust_dataset.txt
516,906
512
u{200f}' | '\u{202a}'..='\u{202e}' | '\u{2060}'..='\u{2064}' | '\u{2066}'..='\u{2069}' | '\u{3000}' | '\u{fe00}'..='\u{fe0f}' | '\u{e0100}'..='\u{e01ef}') } pub(super) fn push_tofu( out: &mut RowScene, paint: &CellPaint, origin_x: i32, origin_y: i32, ...
rust_dataset_chunk_516907
rust_dataset.txt
516,907
512
.graphics() .resident_ids() .into_iter() .map(ImageKey::Kitty), ); resident } pub fn image_area(image: &ImageQuad) -> PixelRect { PixelRect { left: image.x, top: image.y, right: image.x.saturating_add(image.width as i32), botto...
rust_dataset_chunk_516908
rust_dataset.txt
516,908
512
let mut quads: Vec<ImageQuad> = state .sixels() .chunks() .filter_map(|chunk| { clip_to_owning_pane( ImageQuad { key: ImageKey::Sixel(chunk.id), revision: chunk.revision, x: (chunk.cell_x as u32 * metrics.wi...
rust_dataset_chunk_516909
rust_dataset.txt
516,909
512
, PANE_SELECTABLE}; fn stack(ligatures: bool) -> FontStack { FontStack::build(&FontOptions { family: None, size: DEFAULT_FONT_SIZE, system_fonts: false, ligatures, ..crate::text::font::FontOptions::default() }) .unwrap() } fn cache_with(ligatures: bool) -> GlyphCach...
rust_dataset_chunk_516910
rust_dataset.txt
516,910
512
), explicit_background: false, on_cursor: false, inverted_by_cursor: false, composing: false, held: false, cluster: false, continuation: false, complex: false, unit_end: 0, }) .collect() } fn emp...
rust_dataset_chunk_516911
rust_dataset.txt
516,911
512
.text(0, 0, text)); let ligated = scene_with(true, 1, 8, |painter| painter.text(0, 0, text)); assert_eq!(plain, ligated, "{:?} moved with ligatures on", text); } } #[test] fn a_colour_change_inside_a_sequence_keeps_the_ligature_and_paints_each_cell_its_own_colour() { let mut cache = cache_with(...
rust_dataset_chunk_516912
rust_dataset.txt
516,912
512
equals = nominal_in(&mut cache, '='); assert!( !draws(&scene, equals), "a background change broke the ligature" ); assert!( scene .rects .iter() .any(|rect| rect.color == Paints::default().ansi[4] && rect.width == 8), "the selected cell lo...
rust_dataset_chunk_516913
rust_dataset.txt
516,913
512
u16, left: u8, flags: u8) -> PaneRect { PaneRect { x, y: 0, cols, rows: 1, top: 0, bottom: 0, left, right: 0, flags, } } #[test] fn a_pane_boundary_breaks_the_run() { let geometry = GeometryRecord { panes: vec![ pa...
rust_dataset_chunk_516914
rust_dataset.txt
516,914
512
mut cache, 1, 6, |painter| { painter.text(0, 0, "-"); painter.wide(0, 1, '\u{4f60}'); painter.text(0, 3, ">"); }); let dash = nominal_in(&mut cache, '-'); let greater = nominal_in(&mut cache, '>'); assert!(draws(&scene, dash) && draws(&scene, greater)); } #[test] fn the_cursor_c...
rust_dataset_chunk_516915
rust_dataset.txt
516,915
512
!("the fallback glyph did not rasterize: {:?}", other), }; assert!(!draws(&scene, dash), "the ASCII run did not ligate"); assert!(draws(&scene, han), "the fallback glyph was not drawn"); } #[test] fn a_run_of_arabic_is_left_to_the_unshaped_path() { let plain = scene_with(false, 1, 6, |painter| { ...
rust_dataset_chunk_516916
rust_dataset.txt
516,916
512
"{:?}", scene.glyphs); assert_eq!( scene.glyphs[0].x, metrics.width as i32 + nominal.left, "the cluster was not placed at its first cell" ); assert_eq!(scene.glyphs[0].entry, nominal); assert_eq!(shaped, vec![false, true, true, true]); } #[test] fn a_cluster_mapping_that_does_n...
rust_dataset_chunk_516917
rust_dataset.txt
516,917
512
clipped(wide, -60, 0, 16), None); } #[test] fn a_glyph_inside_its_run_is_not_clipped() { let narrow = AtlasEntry { x: 4, y: 4, width: 6, height: 10, left: 1, top: 8, }; assert_eq!(clipped(narrow, 9, 8, 24), Some((9, narrow))); } #[test] fn the_shape_cache_an...
rust_dataset_chunk_516918
rust_dataset.txt
516,918
512
][2].text, ">"); assert_eq!( projected.cells[0].len(), 4, "shaping changed what the lane counts" ); } #[test] fn a_hidden_run_draws_its_pieces_in_the_background_colour() { let mut cache = cache_with(true); let scene = scene_through(&mut cache, 1, 4, |painter| { painter.s...
rust_dataset_chunk_516919
rust_dataset.txt
516,919
512
quad = scene.glyphs[0]; assert_ne!(quad.entry, plain, "the mark was dropped"); assert!( quad.entry.height > plain.height, "the accent does not sit above the letter: {:?} vs {:?}", quad.entry, plain ); assert!(within_columns(&quad, 0, 0, metrics)); } fn assert_drawn_join...
rust_dataset_chunk_516920
rust_dataset.txt
516,920
512
_glyph() { assert_drawn_joined(&[("\u{1f1e9}", 1), ("\u{1f1ea}", 1)]); } #[test] fn a_rainbow_flag_group_is_drawn_as_one_joined_glyph() { assert_drawn_joined(&[("\u{1f3f3}\u{fe0f}\u{200d}", 1), ("\u{1f308}", 2)]); } #[test] fn an_england_tag_flag_is_drawn_as_one_joined_glyph() { assert_drawn_joined(&[( ...
rust_dataset_chunk_516921
rust_dataset.txt
516,921
512
overs_falls_back_to_drawing_each_cell() { let mut cache = cache(); let metrics = cache.metrics(); let a = entry_of(&mut cache, FaceStyle::Regular, 'a'); let scene = scene_through(&mut cache, 1, 4, |painter| { painter.group(0, 0, &[("a", 1), ("\u{10fffd}", 1)]); }); assert!( scene...
rust_dataset_chunk_516922
rust_dataset.txt
516,922
512
|painter| { painter.group(0, 0, &[(MAN, 2), (WOMAN, 2), (GIRL, 2)]); }); Painter::apply(&mut state, |painter| { painter.cluster(0, 0, MAN, 2); painter.text(0, 2, "x "); painter.wide(0, 4, '\u{1f467}'); }); let overwritten = build(&state, &mut cache); let fresh_state ...
rust_dataset_chunk_516923
rust_dataset.txt
516,923
512
Some((3, 3))); let scene = composing(&state, &mut cache, Some(&preedit)); let in_composition: Vec<&GlyphQuad> = scene .glyphs .iter() .filter(|quad| quad.y < metrics.height as i32 && within_columns(quad, 2, 2, metrics)) .collect(); assert_eq!(in_composition.len(), 1, "{:?}",...
rust_dataset_chunk_516924
rust_dataset.txt
516,924
512
::CellMetrics; use zellij_utils::structured_render::{WireColor, ATTR_REVERSE}; #[derive(Debug, Clone, Copy, PartialEq, Eq, Default)] pub struct Margins { pub left: u32, pub top: u32, pub right: u32, pub bottom: u32, } pub fn padding_rects( state: &TerminalState, paints: &Paints, metrics: C...
rust_dataset_chunk_516925
rust_dataset.txt
516,925
512
.width as i32 == x { previous.width += w; return; } } rects.push(Rect { x, y, width: w, height: h, color, }); }; for row in 0..size.rows { let y = row as i32 * hei...
rust_dataset_chunk_516926
rust_dataset.txt
516,926
512
use crate::input::links::LinkRun; use crate::render::atlas::{AtlasEntry, GlyphCache}; use crate::text::font::{CellMetrics, FaceStyle, FontId}; use zellij_utils::input::terminal::OpacityMode; mod decorations; mod glyphs; mod images; mod margins; mod runs; mod units; use decorations::{push_cursor, push_decorations, pus...
rust_dataset_chunk_516927
rust_dataset.txt
516,927
512
Srgb, style: FaceStyle, draw_glyph: bool, hidden: bool, } #[derive(Clone, Copy, PartialEq, Eq)] struct RunKey { style: FaceStyle, region: usize, font: FontId, } struct Run { start: usize, end: usize, text: String, font: FontId, } impl Run { fn refilled(&mut self, cells: &...
rust_dataset_chunk_516928
rust_dataset.txt
516,928
512
< self.y + self.rows } pub fn pixels(&self, metrics: CellMetrics) -> PixelRect { PixelRect { left: (self.x as u32 * metrics.width) as i32, top: (self.y as u32 * metrics.height) as i32, right: ((self.x + self.cols) as u32 * metrics.width) as i32, bottom: ...
rust_dataset_chunk_516929
rust_dataset.txt
516,929
512
geometry.panes[index + 1..] .iter() .map(CellRect::outer_of) .filter(|cover| cover.overlaps(&content)) .collect(); Some(Self { content, covers }) } pub fn holds(&self, row: usize, col: usize) -> bool { self.content.contains(row, col) && !self.cov...
rust_dataset_chunk_516930
rust_dataset.txt
516,930
512
WireCell, Occupancy, Option<Arc<str>>)> = Vec::new(); for column in preedit.columns() { if col + cells.len() + column.width > size.cols { break; } let continues = if column.continues { ATTR_GROUP_CONTINUE } else { 0 ...
rust_dataset_chunk_516931
rust_dataset.txt
516,931
512
asked_for) } } #[derive(Debug, Clone, Copy, PartialEq, Eq)] pub enum BlinkPhase { On, Off, } #[derive(Clone, Copy)] pub struct SceneInputs<'a> { pub state: &'a TerminalState, pub phase: BlinkPhase, pub paints: &'a Paints, pub cursor: CursorOptions, pub hovered_link: Option<&'a LinkRun>...
rust_dataset_chunk_516932
rust_dataset.txt
516,932
512
), None => out.push(cell.character()), } return; } self.state.screen().push_text_to(row, col, out); } fn selects(&self, row: usize, col: usize) -> bool { self.selection .is_some_and(|selection| selection.covers(row, col)) } pu...
rust_dataset_chunk_516933
rust_dataset.txt
516,933
512
cursor_breaks_runs: state .cursor_is_visible() .then_some((cursor_row, cursor_col)), shaping: cache.shapes_runs(), preedit, transparent_background: false, cursor_hollow: cursor.hollow, contrast: None, held_out: &[],...
rust_dataset_chunk_516934
rust_dataset.txt
516,934
512
mut paint = paint_of(cell, occupancy, paints, context.contrast); if blinked_out { paint.foreground = paint.background; paint.hidden = true; } if inverted_by_cursor { let glyph = paint.background; paint.background = paints.cursor_over(paint.foregro...
rust_dataset_chunk_516935
rust_dataset.txt
516,935
512
at = end + 1; } *text = std::mem::take(&mut run.text); } for col in 0..context.size.cols { let RowCell { cell, paint, explicit_background, on_cursor, inverted_by_cursor, composing, held, ...
rust_dataset_chunk_516936
rust_dataset.txt
516,936
512
occupancy: Occupancy, paints: &Paints, contrast: Option<&Contrast>, ) -> CellPaint { let mut foreground = paints.foreground(cell.fg); let mut background = paints.background(cell.bg); let mut tint = OPAQUE; if cell.has(ATTR_DIM) { foreground = color::dim(foreground); tint = c...
rust_dataset_chunk_516937
rust_dataset.txt
516,937
512
col)) { return None; } let region = region_of(geometry, row, col)?; let font = cache.face_of(entry.paint.style, character)?; if font != cache.primary_of(entry.paint.style) { return None; } Some(RunKey { style: entry.paint.style, region, font, }) } pu...
rust_dataset_chunk_516938
rust_dataset.txt
516,938
512
= origin_y + metrics.baseline as i32; let one_paint = cells[run.start..=run.end] .iter() .all(|entry| entry.paint == cells[run.start].paint) .then(|| cells[run.start].paint); for glyph in glyphs.iter() { let Lookup::Rendered(rendered) = cache.shaped_glyph(run.font, glyph.glyph,...
rust_dataset_chunk_516939
rust_dataset.txt
516,939
512
content { GlyphContent::Mask => paint.foreground, GlyphContent::Color => paint.tint, }, }; match content { GlyphContent::Mask => out.glyphs.push(quad), GlyphContent::Color if !paint.hidden => out.color_glyphs.push(quad), GlyphContent::Color => {}, } }...
rust_dataset_chunk_516940
rust_dataset.txt
516,940
512
&TerminalState, cache: &mut GlyphCache, phase: BlinkPhase, paints: &Paints, cursor: CursorOptions, hovered_link: Option<&LinkRun>, preedit: Option<&Preedit>, ) -> Scene { let scene = build_once( SceneInputs { state: state, phase: phase, paints: pa...
rust_dataset_chunk_516941
rust_dataset.txt
516,941
512
); RowCell { cell, occupancy, paint: paint_of(cell, occupancy, &paints, None), explicit_background: false, on_cursor: false, inverted_by_cursor: false, composing: f...
rust_dataset_chunk_516942
rust_dataset.txt
516,942
512
edup(); found } --- FILE: zellij/zellij-terminal/src/render/scene/tests.rs --- use super::images::clip_to_owning_pane; use super::test_helpers::*; use super::*; use crate::emulation::color::{DEFAULT_BACKGROUND, DEFAULT_FOREGROUND}; use crate::render::atlas::Lookup; use crate::testing::painter::{self, Painter, Pla...
rust_dataset_chunk_516943
rust_dataset.txt
516,943
512
_block(scene: &Scene) -> Option<&Rect> { scene .rects .iter() .find(|rect| rect.width == 8 && rect.height == 20) } fn hollow(shape: CursorShape, phase: BlinkPhase) -> Scene { scene_with_cursor( 1, 4, |painter| { painter.text(0, 0, "A"); pa...
rust_dataset_chunk_516944
rust_dataset.txt
516,944
512
{ let off = hollow(CursorShape::Block, BlinkPhase::Off); assert_eq!( off.rects.iter().filter(|rect| rect.x < 8).count(), 4, "{:?}", off.rects ); } #[test] fn a_focused_cursor_is_drawn_as_before() { let focused = scene_with_cursor( 1, 4, |painter|...
rust_dataset_chunk_516945
rust_dataset.txt
516,945
512
(4.5, dark_on_dark); let glyph = scene.glyphs[0].color; assert!( color::contrast_ratio(glyph, [20, 20, 20]) >= 4.5, "{:?}", glyph ); assert_eq!( scene.rects[0].color, [20, 20, 20], "the background must not move" ); } #[test] fn a_minimum_of_one_change...
rust_dataset_chunk_516946
rust_dataset.txt
516,946
512
, |painter| { painter.text(0, 0, "A"); painter.cursor(0, 0, CursorShape::Block); }); let mut cache = cache(); let contrast = Contrast::new(4.5); let paints = Paints { cursor: Some([30, 30, 30]), ..Paints::default() }; let context = RowContext::new( SceneIn...
rust_dataset_chunk_516947
rust_dataset.txt
516,947
512
(), "an application asking for a block was overruled: {:?}", scene.rects ); } #[test] fn a_blinking_cursor_is_absent_from_the_off_phase_and_present_in_the_on_phase() { let blinking = |phase| { scene_with_cursor( 1, 4, |painter| { paint...
rust_dataset_chunk_516948
rust_dataset.txt
516,948
512
configured_paints_reach_the_clear_the_glyphs_and_the_table() { let paints = Paints { foreground: [11, 12, 13], background: [21, 22, 23], cursor: Some([31, 32, 33]), ansi: { let mut ansi = color::ANSI_16; ansi[1] = [41, 42, 43]; ansi }, ...
rust_dataset_chunk_516949
rust_dataset.txt
516,949
512
.expect("no cursor block"); assert_eq!(block.color, [31, 32, 33]); assert_eq!( scene.glyphs[0].color, color::DEFAULT_BACKGROUND, "the character under the block keeps the cell's background" ); } #[test] fn an_unconfigured_block_cursor_still_inverts_the_cell() { let scene ...
rust_dataset_chunk_516950
rust_dataset.txt
516,950
512
scene.glyphs[1].x); } #[test] fn inverse_swaps_foreground_and_background() { let plain = scene_of(1, 2, |painter| { painter.styled(0, 0, "A", |cell| cell.fg = WireColor::Named(1).pack()); }); let inverse = scene_of(1, 2, |painter| { painter.styled(0, 0, "A", |cell| { cell.fg = ...
rust_dataset_chunk_516951
rust_dataset.txt
516,951
512
, 2, blinking, BlinkPhase::Off); assert_eq!(on.glyphs[0].color, color::ANSI_16[1]); assert_eq!(off.glyphs[0].color, color::DEFAULT_BACKGROUND); } #[test] fn a_cell_that_does_not_blink_is_unaffected_by_the_phase() { let plain = |painter: &mut Painter| { painter.styled(0, 0, "A", |cell| cell.fg = Wir...
rust_dataset_chunk_516952
rust_dataset.txt
516,952
512
Lookup::Rendered(rendered) => rendered.entry, other => panic!("expected a rendered glyph, got {:?}", other), } } #[test] fn bold_and_italic_select_different_faces() { let mut cache = cache(); let regular = entry_of(&mut cache, FaceStyle::Regular, 'A'); let bold = entry_of(&mut cache, FaceStyle...
rust_dataset_chunk_516953
rust_dataset.txt
516,953
512
s .iter() .filter(|rect| { rect.y == metrics.underline_top as i32 && rect.width == metrics.width && rect.height == metrics.stroke.max(1) }) .collect(); assert_eq!(strokes.len(), 2, "{:?}", hovered.rects); assert_eq!(strokes[0].x, 0); ...
rust_dataset_chunk_516954
rust_dataset.txt
516,954
512
, preedit, ) } pub(super) fn composing_state() -> TerminalState { Painter::state(2, 8, |painter| { painter.text(0, 0, "ab"); painter.text(1, 0, "second"); painter.cursor(0, 2, CursorShape::Block); }) } #[test] fn a_preedit_is_drawn_at_the_cursor_and_underlined() { let s...
rust_dataset_chunk_516955
rust_dataset.txt
516,955
512
_eq!( untouched(&scene), untouched(&plain), "a composition changed a row it does not sit on" ); let entry = entry_of(&mut cache, FaceStyle::Regular, 'a'); assert!( scene.glyphs.iter().any(|quad| quad.entry == entry), "the text the pane painted is still drawn beneath t...
rust_dataset_chunk_516956
rust_dataset.txt
516,956
512
(|rect| rect.x) .collect(); assert_eq!( strokes, vec![(2 * metrics.width) as i32, (3 * metrics.width) as i32], "a wide character underlines both of the cells it occupies" ); } #[test] fn a_preedit_is_clipped_at_the_end_of_its_row() { let state = Painter::state(1, 4, |painter...
rust_dataset_chunk_516957
rust_dataset.txt
516,957
512
(); assert_eq!(strokes.len(), 2, "{:?}", scene.rects); } #[test] fn an_underline_color_overrides_the_foreground() { let scene = scene_of(1, 2, |painter| { painter.styled(0, 0, "A", |cell| { cell.attrs |= UNDERLINE_STRAIGHT << zellij_utils::structured_render::UNDERLINE_SHIFT; cel...
rust_dataset_chunk_516958
rust_dataset.txt
516,958
512
_the_adjusted_thickness() { let mut cache = thick_underline_cache(); let metrics = cache.metrics(); let state = Painter::state(1, 4, |painter| { painter.links(&[(1, "https://example.com")]); painter.linked(0, 0, "ab", 1); }); let run = LinkRun { id: 1, uri: "https://e...
rust_dataset_chunk_516959
rust_dataset.txt
516,959
512
margins(), ); let (w, h) = (metrics.width as i32, metrics.height as i32); let red = color::test_helpers::indexed(1); let blue = color::test_helpers::indexed(4); assert_eq!(painted(&rects, -1, 0), Some(red), "left of the red cell"); assert_eq!(painted(&rects, -5, -3), Some(red), "top-left...
rust_dataset_chunk_516960
rust_dataset.txt
516,960
512
assert_eq!( painted(&rects, -1, 0), Some(color::test_helpers::indexed(1)) ); assert_eq!( painted(&rects, 2 * metrics.width as i32, 0), None, "a default-background edge must stay see-through like the grid" ); let opaque = padding_rects(&state, &paints, metrics...
rust_dataset_chunk_516961
rust_dataset.txt
516,961
512
); assert!(columns.iter().any(|x| *x >= metrics.width)); } #[test] fn a_dashed_underline_is_half_a_cell_on_and_half_off() { let scene = scene_of(1, 8, underlined(UNDERLINE_DASHED)); let metrics = cache().metrics(); let dash = metrics.width / 2; for rect in &scene.rects { assert!( ...
rust_dataset_chunk_516962
rust_dataset.txt
516,962
512
"{} left the frame: {:?}", style, rect); assert!( rect.y + rect.height as i32 <= metrics.height as i32, "{} bled into the row below: {:?}", style, rect ); } } let struck = scene_of(2, 8, |painter| { painter....
rust_dataset_chunk_516963
rust_dataset.txt
516,963
512
== metrics.height && rect.color == color::DEFAULT_FOREGROUND)); assert_eq!(scene.glyphs[0].color, color::DEFAULT_BACKGROUND); } #[test] fn a_beam_cursor_is_a_narrow_full_height_stroke() { let scene = scene_of(1, 4, |painter| painter.cursor(0, 0, CursorShape::Beam)); let metrics = cache().metrics()...
rust_dataset_chunk_516964
rust_dataset.txt
516,964
512
_neighbour_with_text() { let spill = |text: &str, col: usize| { let state = Painter::state(1, 3, |painter| painter.text(0, 0, text)); let paints = Paints::default(); let cells: Vec<RowCell> = (0..3) .map(|col| { let cell = state.screen().cell(0, col); ...
rust_dataset_chunk_516965
rust_dataset.txt
516,965
512
_empty(), "{:?}", scene.glyphs); assert_eq!(scene.color_glyphs.len(), 1); assert_eq!(scene.color_glyphs[0].color, OPAQUE); } #[test] fn a_dimmed_emoji_is_tinted_rather_than_recolored() { let scene = scene_of(1, 6, |painter| { painter.wide_styled(0, 0, '\u{1f600}', |cell| cell.attrs |= ATTR_DIM); ...
rust_dataset_chunk_516966
rust_dataset.txt
516,966
512
_at_the_cell_it_names() { let scene = scene_with_graphics( 4, 8, &[ image(1, 16, 40), Place::of(1, 16, 40).at(1, 2).offset(2, 3).record(), ], ); assert_eq!(scene.images.len(), 1); let quad = &scene.images[0]; assert_eq!((quad.x, quad.y), (2 * 8...
rust_dataset_chunk_516967
rust_dataset.txt
516,967
512
{ CellMetrics { width, height, ..cache().metrics() } } #[test] fn an_image_inside_its_pane_is_left_alone() { let geometry = GeometryRecord { panes: vec![clipping_pane(0, 0, 8, 4)], }; let quad = quad_at(16, 20, 16, 20); let clipped = clip_to_owning_pane(...
rust_dataset_chunk_516968
rust_dataset.txt
516,968
512
, clipped.height), (48, 60)); } #[test] fn an_image_wholly_outside_its_pane_is_dropped() { let geometry = GeometryRecord { panes: vec![clipping_pane(0, 0, 4, 4)], }; assert_eq!( clip_to_owning_pane(quad_at(64, 0, 32, 20), 0, 0, &geometry, metrics_of(8, 20)), None ); } #[test] f...
rust_dataset_chunk_516969
rust_dataset.txt
516,969
512
_way_into_the_scene() { let state = Painter::state(4, 8, |painter| { painter.geometry(&GeometryRecord { panes: vec![clipping_pane(0, 0, 4, 4), clipping_pane(4, 0, 4, 4)], }); painter.graphics(&[image(1, 64, 20), Place::of(1, 64, 20).at(0, 2).record()]); }); let scene = bu...
rust_dataset_chunk_516970
rust_dataset.txt
516,970
512
_empty()); } fn sixel(width: usize, height: usize) -> String { format!( "\u{1b}P0;1;0q\"1;1;{};{}#0;2;100;0;0!{}~\u{1b}\\", width, height, width ) } #[test] fn a_sixel_chunk_becomes_a_quad_at_the_cell_its_record_names() { let scene = scene_with_graphics(4, 8, &[painter::sixel_chunk(1, 2, 2...
rust_dataset_chunk_516971
rust_dataset.txt
516,971
512
<< zellij_utils::structured_render::UNDERLINE_SHIFT; }); }; assert_eq!(scene_of(4, 20, paint), scene_of(4, 20, paint)); } --- FILE: zellij/zellij-terminal/src/render/scene/units.rs --- use crate::emulation::screen_buffer::Occupancy; use crate::render::atlas::{ClusterLookup, GlyphCache, GlyphKey, Rend...
rust_dataset_chunk_516972
rust_dataset.txt
516,972
512
cache: &mut GlyphCache, cells: &[RowCell], text: &mut String, UnitCols { row, start, end }: UnitCols, origin_y: i32, ) { let metrics = context.metrics; let end = end.min(cells.len()).max(start + 1); let heads: Vec<usize> = (start..end) .filter(|col| cells[*col].occupancy != Occup...
rust_dataset_chunk_516973
rust_dataset.txt
516,973
512
col + 1; while end < cells.len() && cells[end].occupancy == Occupancy::WideTail { end += 1; } let origin_x = (col as u32 * metrics.width) as i32; if let Some(cluster) = context.cluster_at(row, col) { let budget = (end - col) as u32; match cache.cluster_glyph(entry.paint.style, &...
rust_dataset_chunk_516974
rust_dataset.txt
516,974
512
std::collections::VecDeque; use std::sync::Arc; use std::time::{Duration, Instant}; use zellij_utils::structured_render::{FrameBuilder, FrameView, WireCell}; use crate::emulation::color::Contrast; use crate::emulation::terminal::TerminalState; use crate::render::atlas::GlyphCache; use crate::render::scene::SceneInpu...
rust_dataset_chunk_516975
rust_dataset.txt
516,975
512
} } } cells } fn ease_out(progress: f64) -> f64 { let remaining = 1.0 - progress.clamp(0.0, 1.0); 1.0 - remaining * remaining * remaining } impl PaneAnimation { fn offset_at(&self, now: Instant) -> f64 { if self.duration.is_zero() { return 0.0; } ...
rust_dataset_chunk_516976
rust_dataset.txt
516,976
512
usters_before(before, row); self.below_clusters.push_front(clusters); } for _ in 0..moved { self.above.pop_front(); self.above_clusters.pop_front(); } self.below.truncate(rows); self.below_clusters.truncate(rows)...
rust_dataset_chunk_516977
rust_dataset.txt
516,977
512
: RowScratch, row: RowScene, } impl ScrollAnimations { pub fn is_active(&self) -> bool { !self.panes.is_empty() } pub fn cancel(&mut self) { self.panes.clear(); } pub fn note_frame( &mut self, before: &TerminalState, view: &FrameView<'_>, settin...
rust_dataset_chunk_516978
rust_dataset.txt
516,978
512
now; animation.duration = settings.duration; if target == 0.0 { self.panes.remove(at); } } } fn push( &mut self, pane: usize, content: CellRect, grid_cols: usize, now: Instant, duration: Duration, )...
rust_dataset_chunk_516979
rust_dataset.txt
516,979
512
) .with_contrast(contrast) .with_only(&held); for row in content.y..(content.y + content.rows).min(rows) { scene::build_row(&live, cache, row, scratch, row_scene); push_clipped(layer, row_scene, offset, &regions); } for ...
rust_dataset_chunk_516980
rust_dataset.txt
516,980
512
_add(height as i32), } } pub fn clip_rect(rect: &Rect, dy: i32, region: &PixelRect) -> Option<Rect> { let kept = area(rect.x, rect.y + dy, rect.width, rect.height).intersection(region)?; Some(Rect { x: kept.left, y: kept.top, width: (kept.right - kept.left) as u32, height: (...
rust_dataset_chunk_516981
rust_dataset.txt
516,981
512
20; pub const CELL_HEIGHT: u32 = 20; pub const DURATION: Duration = Duration::from_millis(100); pub fn framed(x: u16, y: u16, cols: u16, rows: u16) -> PaneRect { PaneRect { x, y, cols, rows, top: 1, bottom: 1, left...
rust_dataset_chunk_516982
rust_dataset.txt
516,982
512
u16, ROWS as u16, seq); builder.set_full_repaint(full); builder.set_clear(full); for row in 0..ROWS { let cells: Vec<WireCell> = (0..COLS).map(|col| cell_at(base, row, col)).collect(); builder.push_row(row as u16, 0, &cells); } if let Some(geometry) = geo...
rust_dataset_chunk_516983
rust_dataset.txt
516,983
512
cell| cell.character()).collect() } } pub fn mid_slide( cache: &mut GlyphCache, ) -> (crate::render::retained::RetainedScene, ScrollLayer) { let mut scene = Scene::new(); scene.cell_height = cache.metrics().height; let start = Instant::now(); scene.scroll(3, ...
rust_dataset_chunk_516984
rust_dataset.txt
516,984
512
.scroll.animating(1)); assert!(!scene.scroll.retire(start + DURATION / 2)); assert!(scene.scroll.retire(start + DURATION)); assert!(!scene.scroll.is_active()); } #[test] fn scrolling_the_other_way_starts_below_and_slides_up() { let mut scene = Scene::new(); let star...
rust_dataset_chunk_516985
rust_dataset.txt
516,985
512
3; scene.scroll(3, later); for step in 0..10 { check(&scene, later + DURATION * step / 10); } let reversed = later + DURATION / 2; scene.scroll(-4, reversed); for step in 0..10 { check(&scene, reversed + DURATION * step / 10); } le...
rust_dataset_chunk_516986
rust_dataset.txt
516,986
512
5; let bytes = frame(scene.seq, false, Some(moved), scene.base, &[]); scene.apply(&bytes, on(), start); assert!(!scene.scroll.is_active()); } #[test] fn a_repeated_unchanged_geometry_record_does_not_stop_the_animation() { let mut scene = Scene::new(); let start = In...
rust_dataset_chunk_516987
rust_dataset.txt
516,987
512
, SceneInputs { state: &scene.state, phase: BlinkPhase::On, paints: &Paints::default(), cursor: CursorOptions::default(), hovered_link: None, preedit: None, }, cache, Transpare...
rust_dataset_chunk_516988
rust_dataset.txt
516,988
512
(&panes().panes[0]).pixels(metrics); let bottom_row = PixelRect { top: content.bottom - metrics.height as i32, ..content }; assert!( layer.rects.iter().any(|rect| bottom_row .intersection(&area(rect.x, rect.y, rect.width, rect.height)) ...
rust_dataset_chunk_516989
rust_dataset.txt
516,989
512
(), crate::render::scene::test_helpers::build(&scene.state, &mut cache), "ending the animation restores the plain rows" ); } #[test] fn no_layer_is_built_while_nothing_animates() { let mut cache = cache(); let mut scene = Scene::new(); let layer = lay...
rust_dataset_chunk_516990
rust_dataset.txt
516,990
512
() .find(|animation| animation.pane == pane) .map(|animation| animation.offset_at(now)) } pub fn animating(&self, pane: usize) -> bool { self.panes.iter().any(|animation| animation.pane == pane) } pub fn uncovered_rows(&self, pane: usize, now: Instant, cell_height: u32)...
rust_dataset_chunk_516991
rust_dataset.txt
516,991
512
'\u{2500}'..='\u{257f}' => lines(&mut canvas, &pen, arms_of(character)?), '\u{e0b0}'..='\u{e0b3}' => powerline(&mut canvas, &pen, character), _ => return None, } Some(GlyphBitmap { left: 0, top: metrics.baseline as i32, width: canvas.width as u32, height: canvas....
rust_dataset_chunk_516992
rust_dataset.txt
516,992
512
{ let mut hits = 0u32; for sy in 0..SUPERSAMPLES { for sx in 0..SUPERSAMPLES { let px = x as f32 + (sx as f32 + 0.5) * step; let py = y as f32 + (sy as f32 + 0.5) * step; if inside(px, py) { ...
rust_dataset_chunk_516993
rust_dataset.txt
516,993
512
'\u{2580}' => canvas.fill(0, 0, w, mid_y, OPAQUE), '\u{2581}'..='\u{2588}' => { let count = character as i32 - 0x2580; canvas.fill(0, lower(count), w, h, OPAQUE); }, '\u{2589}'..='\u{258f}' => { let count = 0x2590 - character as i32; canvas...
rust_dataset_chunk_516994
rust_dataset.txt
516,994
512
down: u8, left: u8, } const fn arms(up: u8, right: u8, down: u8, left: u8) -> Arms { Arms { up, right, down, left, } } fn arms_of(character: char) -> Option<Arms> { const L: u8 = LIGHT; const H: u8 = HEAVY; const D: u8 = DOUBLE; const O: u8 = NONE; l...
rust_dataset_chunk_516995
rust_dataset.txt
516,995
512
f}' => arms(L, L, H, O), '\u{2520}' => arms(H, L, H, O), '\u{2521}' => arms(H, H, L, O), '\u{2522}' => arms(L, H, H, O), '\u{2523}' => arms(H, H, H, O), '\u{2524}' => arms(L, O, L, L), '\u{2525}' => arms(L, O, L, H), '\u{2526}' => arms(H, O, L, L), '\u{252...
rust_dataset_chunk_516996
rust_dataset.txt
516,996
512
=> arms(L, L, L, H), '\u{253e}' => arms(L, H, L, L), '\u{253f}' => arms(L, H, L, H), '\u{2540}' => arms(H, L, L, L), '\u{2541}' => arms(L, L, H, L), '\u{2542}' => arms(H, L, H, L), '\u{2543}' => arms(H, L, L, H), '\u{2544}' => arms(H, H, L, L), '\u{2545}'...
rust_dataset_chunk_516997
rust_dataset.txt
516,997
512
(D, L, D, O), '\u{2560}' => arms(D, D, D, O), '\u{2561}' => arms(L, O, L, D), '\u{2562}' => arms(D, O, D, L), '\u{2563}' => arms(D, O, D, D), '\u{2564}' => arms(O, D, L, D), '\u{2565}' => arms(O, L, D, L), '\u{2566}' => arms(O, D, D, D), '\u{2567}' => arms...
rust_dataset_chunk_516998
rust_dataset.txt
516,998
512
start + light), second: (start + light * 2, start + light * 3), } } fn thickest_single(pen: &Pen, a: u8, b: u8) -> i32 { [a, b] .into_iter() .filter(|weight| *weight == LIGHT || *weight == HEAVY) .map(|weight| pen.thickness(weight)) .max() .unwrap_or(0) } fn cr...
rust_dataset_chunk_516999
rust_dataset.txt
516,999
512
is_left { canvas.fill(0, span.0, edge, span.1, OPAQUE); } else { canvas.fill(edge, span.0, w, span.1, OPAQUE); } } }, _ => { let span = centered(h, pen.thickness(weight)); ...