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_512900 | rust_dataset.txt | 512,900 | 512 | ,
structured_render_clients,
..Default::default()
}
}
pub fn add_clients(
&mut self,
client_ids: &HashSet<ClientId>,
link_handler: Rc<RefCell<LinkHandler>>,
floating_panes_stack: Option<FloatingPanesStack>,
) {
self.link_handler = Some... |
rust_dataset_chunk_512901 | rust_dataset.txt | 512,901 | 512 | }
}
pub fn add_character_chunks_to_client(
&mut self,
client_id: ClientId,
mut character_chunks: Vec<CharacterChunk>,
z_index: Option<usize>,
) -> Result<()> {
if let Some(popup_cover) = self.popup_cover_for(client_id, z_index) {
character_chunks = popup_... |
rust_dataset_chunk_512902 | rust_dataset.txt | 512,902 | 512 | }
pub fn mark_host_display_cleared_for_clients(
&mut self,
client_ids: impl Iterator<Item = ClientId>,
) {
for client_id in client_ids {
self.clients_with_cleared_host_display.insert(client_id);
}
}
pub fn mark_host_display_cleared_for_client(&mut self, clien... |
rust_dataset_chunk_512903 | rust_dataset.txt | 512,903 | 512 | self.character_cell_size.borrow() {
let sixel_chunks = if let Some(floating_panes_stack) = &self.floating_panes_stack {
floating_panes_stack.visible_sixel_image_chunks(
sixel_image_chunks,
z_index,
&character_cell_size,
... |
rust_dataset_chunk_512904 | rust_dataset.txt | 512,904 | 512 | ) {
let kitty_chunks = match (
*self.character_cell_size.borrow(),
&self.floating_panes_stack,
) {
(Some(character_cell_size), Some(floating_panes_stack)) => floating_panes_stack
.visible_kitty_image_chunks(kitty_image_chunks, z_index, &character_c... |
rust_dataset_chunk_512905 | rust_dataset.txt | 512,905 | 512 | )
})
.with_context(err_context)?;
if host_display_cleared {
builder.set_clear(true);
}
host_display_cleared = builder.is_clear();
Some(builder)
} else {
Non... |
rust_dataset_chunk_512906 | rust_dataset.txt | 512,906 | 512 | {
None
};
if let Some(mut builder) = structured_builder.take() {
let panes = self
.client_pane_rects
.remove(&client_id)
.unwrap_or_default();
let geometry_pushed = push_geometry_if_chan... |
rust_dataset_chunk_512907 | rust_dataset.txt | 512,907 | 512 | )?,
); // TODO: less allocations?
// append post-vte instructions for this client
if let Some(post_vte_instructions_for_client) =
self.post_vte_instructions.remove(&client_id)
{
for vte_instruction in post_vte_instructions_for_client {
... |
rust_dataset_chunk_512908 | rust_dataset.txt | 512,908 | 512 | .map(|clipped| (clipped, *scroll))
})
.collect()
})
.unwrap_or_default();
let geometry_pushed = push_geometry_if_changed(
&self.structured_render_clients,
watcher_id,
GeometryRecord {
... |
rust_dataset_chunk_512909 | rust_dataset.txt | 512,909 | 512 | ) {
self.client_cursor.insert(
client_id,
CursorState {
x: x.min(u16::MAX as usize) as u16,
y: y.min(u16::MAX as usize) as u16,
shape: wire_cursor_shape(shape_csi),
visible,
},
);
}
pub fn ser... |
rust_dataset_chunk_512910 | rust_dataset.txt | 512,910 | 512 | if client_host_is_sixel_capable {
self.sixel_chunks.get(&client_id)
} else {
None
};
client_serialized_render_instructions.push_str(
&serialize_chunks(
client_character_chunks,
sixel_chunks_for_c... |
rust_dataset_chunk_512911 | rust_dataset.txt | 512,911 | 512 | post_vte are not considered rendered assets as they should not be visible
self.client_character_chunks.values().any(|c| !c.is_empty())
|| self.sixel_chunks.values().any(|c| !c.is_empty())
|| self
.client_kitty_chunks
.values()
.any(|chunks... |
rust_dataset_chunk_512912 | rust_dataset.txt | 512,912 | 512 | , Default)]
pub struct FloatingPanesStack {
pub layers: Vec<PaneGeom>,
}
impl FloatingPanesStack {
pub fn visible_character_chunks(
&self,
mut character_chunks: Vec<CharacterChunk>,
z_index: Option<usize>,
) -> Result<Vec<CharacterChunk>> {
let err_context = || {
... |
rust_dataset_chunk_512913 | rust_dataset.txt | 512,913 | 512 | s_chunk, character_cell_size);
chunks_to_check.append(&mut uncovered_chunks);
}
}
chunks_to_check
}
pub fn visible_kitty_image_chunks(
&self,
mut kitty_image_chunks: Vec<KittyImageChunk>,
z_index: Option<usize>,
character_cell_size: &Si... |
rust_dataset_chunk_512914 | rust_dataset.txt | 512,914 | 512 | k_chunk_top_edge = k_chunk.cell_y * character_cell_size.height;
let k_chunk_bottom_edge = k_chunk_top_edge + rounded_kitty_image_pixel_height;
let k_chunk_left_edge = k_chunk.cell_x * character_cell_size.width;
let k_chunk_right_edge = k_chunk_left_edge + rounded_kitty_image_pixel_width;
... |
rust_dataset_chunk_512915 | rust_dataset.txt | 512,915 | 512 |
+ (pane_bottom_edge - k_chunk_top_edge)
+ character_cell_size.height,
source_px_width: rounded_kitty_image_pixel_width,
source_px_height: (rounded_kitty_image_pixel_height
- (pane_bottom_edge - k_chunk_top_edge))
... |
rust_dataset_chunk_512916 | rust_dataset.txt | 512,916 | 512 | + character_cell_size.width;
let right_image_chunk = KittyImageChunk {
cell_x: (pane_right_edge / character_cell_size.width) + 1,
cell_y: std::cmp::max(k_chunk.cell_y, pane_top_edge / character_cell_size.height),
source_px_x,
source_px_y,
... |
rust_dataset_chunk_512917 | rust_dataset.txt | 512,917 | 512 | _chunk_left_side);
drop(covered_part);
c_chunk.x = pane_right_edge + 1;
// The chunk now starts right after the floating pane; a wide cell or cluster
// may have straddled that edge, so erase before drawing (see `serialize_chunks`).
c_chunk... |
rust_dataset_chunk_512918 | rust_dataset.txt | 512,918 | 512 | InPixels,
) -> Vec<SixelImageChunk> {
// round these up to the nearest cell edge
let rounded_sixel_image_pixel_height =
if s_chunk.sixel_image_pixel_height % character_cell_size.height > 0 {
let modulus = s_chunk.sixel_image_pixel_height % character_cell_size.height;
... |
rust_dataset_chunk_512919 | rust_dataset.txt | 512,919 | 512 | >= s_chunk_top_edge && pane_bottom_edge <= s_chunk_bottom_edge)
|| (pane_top_edge <= s_chunk_top_edge && pane_bottom_edge >= s_chunk_bottom_edge);
if pane_covers_chunk_completely {
return uncovered_chunks;
}
if pane_top_edge >= s_chunk_top_edge
&& pane_top_ed... |
rust_dataset_chunk_512920 | rust_dataset.txt | 512,920 | 512 | s_chunk_top_edge < pane_top_edge {
rounded_sixel_image_pixel_height.saturating_sub(pane_top_edge - s_chunk_top_edge)
} else {
rounded_sixel_image_pixel_height
};
let left_image_chunk = SixelImageChunk {
cell_x: s_chunk.cell_x,
... |
rust_dataset_chunk_512921 | rust_dataset.txt | 512,921 | 512 | el_image_pixel_x,
sixel_image_pixel_y,
sixel_image_pixel_width: (rounded_sixel_image_pixel_width
.saturating_sub(pane_right_edge - s_chunk_left_edge))
.saturating_sub(character_cell_size.width),
sixel_image_pixel_height: std::cmp::min(
... |
rust_dataset_chunk_512922 | rust_dataset.txt | 512,922 | 512 | const { std::cell::Cell::new(false) };
}
pub fn set_row_shifts(enabled: bool) {
ROW_SHIFTS.with(|flag| flag.set(enabled));
}
pub fn row_shifts_enabled() -> bool {
ROW_SHIFTS.with(|flag| flag.get())
}
#[derive(Debug, Clone, Default)]
pub struct CharacterChunk {
pub terminal_characters: Vec<TerminalCharac... |
rust_dataset_chunk_512923 | rust_dataset.txt | 512,923 | 512 | Option<AnsiCode>) {
self.pane_default_fg = fg;
self.pane_default_bg = bg;
}
pub fn changed_colors(&self) -> Option<[Option<AnsiCode>; 256]> {
self.changed_colors
}
pub fn width(&self) -> usize {
let mut width = 0;
for t_character in &self.terminal_characters {
... |
rust_dataset_chunk_512924 | rust_dataset.txt | 512,924 | 512 | characters_on_the_left: Vec<TerminalCharacter> =
self.drain_by_width(middle_start).collect();
drop(
self.drain_by_width(middle_end - middle_start)
.collect::<Vec<_>>(),
);
let characters_on_the_right: Vec<TerminalCharacter> =
self.terminal_cha... |
rust_dataset_chunk_512925 | rust_dataset.txt | 512,925 | 512 | _height: usize) {
if self.should_update_all_lines {
return;
}
if self.shifted_up + 1 >= viewport_height {
self.update_all_lines();
return;
}
self.shifted_up += 1;
self.changed_lines
.insert(viewport_height - 1 + self.shifted... |
rust_dataset_chunk_512926 | rust_dataset.txt | 512,926 | 512 | chunk_starts_a_line,
None,
None,
self.styled_underlines,
osc8_hyperlinks,
max_size,
)
}
pub fn changed_chunks_in_viewport(
&self,
viewport: &[Row],
viewport_width: usize,
viewport_height: usize,
x_offset:... |
rust_dataset_chunk_512927 | rust_dataset.txt | 512,927 | 512 | cloned().collect();
// pad row
let row_width = row.width();
if row_width < viewport_width {
let mut pad_character = EMPTY_TERMINAL_CHARACTER;
if let Some(bg_color) = row.bg_color {
pad_character
.styles
.update(|styl... |
rust_dataset_chunk_512928 | rust_dataset.txt | 512,928 | 512 | _line_count = 1;
},
};
// TODO: move this whole thing to output_buffer
let mut lines = self.changed_viewport_lines(viewport_height);
lines.sort_unstable();
for line_index in lines {
add_changed_line(line_index);
}
if let Some(changed_line_... |
rust_dataset_chunk_512929 | rust_dataset.txt | 512,929 | 512 | new(RefCell::new(HashMap::new())),
Rc::new(RefCell::new(HashMap::new())),
Rc::new(RefCell::new(HashMap::new())),
Rc::new(RefCell::new(HashMap::new())),
Rc::new(RefCell::new(HashMap::new())),
)
}
/// Helper to create a simple CharacterChunk with text
fn create_character_chunk_from_st... |
rust_dataset_chunk_512930 | rust_dataset.txt | 512,930 | 512 | ::new()));
output.add_clients(&client_ids, link_handler, None);
let chunk = create_character_chunk_from_str("Hi", 0, 0);
output
.add_character_chunks_to_client(1, vec![chunk], None)
.unwrap();
assert!(
output.is_dirty(),
"Output should be dirty after adding character ch... |
rust_dataset_chunk_512931 | rust_dataset.txt | 512,931 | 512 | _rendered_assets(),
"Empty output should not have rendered assets"
);
}
#[test]
fn test_has_rendered_assets_only_vte_instructions() {
let mut output = create_test_output();
let client_ids = create_test_clients(1);
let link_handler = Rc::new(RefCell::new(LinkHandler::new()));
output.add_clie... |
rust_dataset_chunk_512932 | rust_dataset.txt | 512,932 | 512 | empty HashMap"
);
}
#[test]
fn test_serialize_single_client_simple_text() {
let mut output = create_test_output();
let client_ids = create_test_clients(1);
let link_handler = Rc::new(RefCell::new(LinkHandler::new()));
output.add_clients(&client_ids, link_handler, None);
let chunk = create_cha... |
rust_dataset_chunk_512933 | rust_dataset.txt | 512,933 | 512 | #[test]
fn test_serialize_with_pre_and_post_vte_instructions() {
let mut output = create_test_output();
let client_ids = create_test_clients(1);
let link_handler = Rc::new(RefCell::new(LinkHandler::new()));
output.add_clients(&client_ids, link_handler, None);
output.add_pre_vte_instruction_to_clien... |
rust_dataset_chunk_512934 | rust_dataset.txt | 512,934 | 512 | Rc::new(RefCell::new(LinkHandler::new()));
output.add_clients(&client_ids, link_handler, None);
let chunk = create_character_chunk_from_str("Hello", 0, 0);
output
.add_character_chunks_to_client(1, vec![chunk], None)
.unwrap();
let result = output.serialize_with_size(None, None).unwra... |
rust_dataset_chunk_512935 | rust_dataset.txt | 512,935 | 512 | .add_character_chunks_to_client(1, vec![chunk_outside], None)
.unwrap();
// Add chunk within visible area
let chunk_visible = create_character_chunk_from_str("Visible", 5, 5);
output
.add_character_chunks_to_client(1, vec![chunk_visible], None)
.unwrap();
let result = o... |
rust_dataset_chunk_512936 | rust_dataset.txt | 512,936 | 512 | _character_chunks_to_client(1, vec![chunk], None)
.unwrap();
let result = output.serialize_with_size(max_size, content_size).unwrap();
let client_output = result.get(&1).unwrap();
// Verify padding/clearing instructions are present
// Should contain clear line instructions: \u{1b}[y;xH\u{1b}[m... |
rust_dataset_chunk_512937 | rust_dataset.txt | 512,937 | 512 | new(SixelImageStore::default())),
Rc::new(RefCell::new(Some(SizeInPixels {
height: 20,
width: 10,
}))),
true,
true,
Rc::new(RefCell::new(KittyImageStore::default())),
Rc::new(RefCell::new(HashMap::new())),
Rc::new(RefCell::new(HashMap::new(... |
rust_dataset_chunk_512938 | rust_dataset.txt | 512,938 | 512 | ().rows),
(20, 10),
"the frame must carry the watcher's viewport"
);
let screen = watcher_text(&frame, watcher_size.cols, watcher_size.rows);
assert_eq!(
screen[5], " 12345",
"a run crossing the watcher's right edge must be truncated at it"
);
assert!(
... |
rust_dataset_chunk_512939 | rust_dataset.txt | 512,939 | 512 | _id = 2;
let watcher_size = Size { rows: 10, cols: 20 };
let mut output = create_watcher_output(watcher_id, watcher_size);
let link_handler = Rc::new(RefCell::new(LinkHandler::new()));
output.add_clients(&create_test_clients(1), link_handler, None);
output.set_client_cursor(followed_id, 25, 5, true... |
rust_dataset_chunk_512940 | rust_dataset.txt | 512,940 | 512 | YLES};
let followed_id = 1;
let watcher_id = 2;
let watcher_size = Size { rows: 4, cols: 8 };
let mut output = create_watcher_output(watcher_id, watcher_size);
let link_handler = Rc::new(RefCell::new(LinkHandler::new()));
output.add_clients(&create_test_clients(1), link_handler.clone(), None);
... |
rust_dataset_chunk_512941 | rust_dataset.txt | 512,941 | 512 | all(|row| row.iter().all(|id| *id == 0)),
"a row below the watcher must not be in the frame"
);
}
#[test]
fn test_add_character_chunks_to_multiple_clients() {
let mut output = create_test_output();
let client_ids = create_test_clients(3);
let link_handler = Rc::new(RefCell::new(LinkHandler::new... |
rust_dataset_chunk_512942 | rust_dataset.txt | 512,942 | 512 | .len(),
1,
"Should have one character"
);
}
#[test]
fn test_character_chunk_width() {
let chunk = create_character_chunk_from_str("Hello", 0, 0);
assert_eq!(chunk.width(), 5, "Width should be 5 for 'Hello'");
// Test with wide characters
let terminal_chars: Vec<TerminalCharacter> =... |
rust_dataset_chunk_512943 | rust_dataset.txt | 512,943 | 512 | assert!(
drained.len() >= 2,
"Drained part should have at least 2 characters"
);
}
#[test]
fn test_character_chunk_retain_by_width() {
let mut chunk = create_character_chunk_from_str("Hello World", 0, 0);
// Retain only first 5 characters
chunk.retain_by_width(5);
assert_eq!(
... |
rust_dataset_chunk_512944 | rust_dataset.txt | 512,944 | 512 | let pane_geom = create_pane_geom(0, 5, 10, 1);
let stack = FloatingPanesStack {
layers: vec![pane_geom],
};
// Chunk that spans x=5-15, pane covers x=0-9
let chunks = vec![create_character_chunk_from_str("HelloWorld", 5, 5)];
let visible = stack.visible_character_chunks(chunks, Some(0)).u... |
rust_dataset_chunk_512945 | rust_dataset.txt | 512,945 | 512 | loating_panes() {
let pane_geom = create_pane_geom(5, 5, 10, 10);
let stack = FloatingPanesStack {
layers: vec![pane_geom],
};
// Cursor inside pane bounds
assert!(
!stack.cursor_is_visible(7, 7, None),
"Cursor should not be visible when covered by pane"
);
// Curso... |
rust_dataset_chunk_512946 | rust_dataset.txt | 512,946 | 512 | (bottom): pane at (5,5)
// Layer 1 (middle): pane at (10,10)
// Layer 2 (top): pane at (5,5) - overlaps with layer 0
let layer0_pane = create_pane_geom(5, 5, 10, 10);
let layer1_pane = create_pane_geom(10, 10, 10, 10);
let layer2_pane = create_pane_geom(5, 5, 10, 10);
let stack = FloatingPanes... |
rust_dataset_chunk_512947 | rust_dataset.txt | 512,947 | 512 | true;
let stack = FloatingPanesStack {
layers: vec![floating_pane, pinned_pane],
};
// Cursor in the floating pane (z-index 0) at position covered by pinned pane
assert!(
!stack.cursor_is_visible(15, 15, Some(0)),
"Cursor in floating pane should be hidden when covered by pinne... |
rust_dataset_chunk_512948 | rust_dataset.txt | 512,948 | 512 | ]
fn test_output_buffer_update_all_lines() {
let mut buffer = OutputBuffer::default();
assert!(
buffer.should_update_all_lines,
"Should update all lines by default"
);
buffer.clear();
assert!(
!buffer.should_update_all_lines,
"Should not update all lines after clear... |
rust_dataset_chunk_512949 | rust_dataset.txt | 512,949 | 512 | _eq!(chunks[0].y, 2, "First chunk should be at line 2");
assert_eq!(chunks[1].y, 5, "Second chunk should be at line 5");
assert_eq!(chunks[2].y, 7, "Third chunk should be at line 7");
}
#[test]
fn test_pane_defaults_preserved_when_middle_covered() {
let pane_geom = create_pane_geom(5, 5, 3, 1);
let sta... |
rust_dataset_chunk_512950 | rust_dataset.txt | 512,950 | 512 | _preserved_when_right_covered() {
let pane_geom = create_pane_geom(5, 5, 10, 1);
let stack = FloatingPanesStack {
layers: vec![pane_geom],
};
let pane_bg = Some(AnsiCode::RgbCode((0, 26, 58)));
let mut chunk = create_character_chunk_from_str("0123456789", 0, 5);
chunk.pane_default_bg =... |
rust_dataset_chunk_512951 | rust_dataset.txt | 512,951 | 512 | .clone(),
parts.2.clone(),
Rc::new(RefCell::new(HashMap::new())),
Rc::new(RefCell::new(HashMap::new())),
)
}
fn store_test_kitty_image(
kitty_image_store: &Rc<RefCell<KittyImageStore>>,
width: u32,
height: u32,
) -> InternalImageId {
kitty_image_store
.borrow_mut()
... |
rust_dataset_chunk_512952 | rust_dataset.txt | 512,952 | 512 | let mut inflated = Vec::new();
flate2::read::ZlibDecoder::new(&compressed[..])
.read_to_end(&mut inflated)
.unwrap();
inflated
}
fn kitty_chunk(
internal_image_id: InternalImageId,
placement_uid: u64,
cell_x: usize,
cell_y: usize,
) -> KittyImageChunk {
KittyImageChunk {... |
rust_dataset_chunk_512953 | rust_dataset.txt | 512,953 | 512 | .ansi().to_owned())
.unwrap_or_default()
}
fn run_kitty_frame_with_host_clear(parts: &KittyTestParts, chunks: Vec<KittyImageChunk>) -> String {
let mut output = create_test_kitty_output(parts);
let client_ids: HashSet<ClientId> = create_test_clients(1);
let link_handler = Rc::new(RefCell::new(LinkH... |
rust_dataset_chunk_512954 | rust_dataset.txt | 512,954 | 512 | > = HashMap::new();
for key_value in after[..end].split(',') {
let mut parts = key_value.splitn(2, '=');
let key = parts.next().unwrap();
let value = parts.next().unwrap_or("");
params.insert(key, value);
}
let before = output[..absolute_position]
... |
rust_dataset_chunk_512955 | rust_dataset.txt | 512,955 | 512 | (',') {
match pair.split_once('=') {
Some(("t", value)) => medium = value.chars().next().unwrap(),
Some(("S", value)) => size = value.parse().unwrap(),
_ => {},
}
}
let name = String::from_utf8(BASE64_ENCODER.decode(payload).unwrap()).unwrap();
let path = ... |
rust_dataset_chunk_512956 | rust_dataset.txt | 512,956 | 512 | ![7u8; 20 * 30 * 4]);
let mut chunk = kitty_chunk(internal, 1, 0, 0);
chunk.scaled_image = Some(key);
let frame = run_kitty_frame(&parts, vec![chunk], None);
let (_, path, size) = kitty_media_reference(&frame);
assert_eq!(size, 20 * 30 * 4);
let written = std::fs::read(&path).expect("the media ... |
rust_dataset_chunk_512957 | rust_dataset.txt | 512,957 | 512 | internal = store_test_kitty_image(&parts.0, 4, 4);
let frame = run_kitty_frame(&parts, vec![kitty_chunk(internal, 1, 0, 0)], None);
let (_, path, _) = kitty_media_reference(&frame);
assert!(path.exists());
run_kitty_frame_with_host_clear(&parts, vec![kitty_chunk(internal, 1, 0, 0)]);
assert!(
... |
rust_dataset_chunk_512958 | rust_dataset.txt | 512,958 | 512 | ,
},
);
let internal = store_test_kitty_image(&parts.0, 30, 40);
let output = run_kitty_frame(&parts, vec![kitty_chunk(internal, 1, 0, 0)], None);
let (control, payload) = kitty_transmit_control_and_payload(&output);
assert!(control.starts_with("a=t,q=2,f=32,t=d,i=2000000000,s=30,v=40,m="));... |
rust_dataset_chunk_512959 | rust_dataset.txt | 512,959 | 512 | ),
vec![255u8; 30 * 40 * 4]
);
}
#[test]
fn kitty_transmit_chunks_incompressible_payload() {
let parts = create_test_kitty_parts();
let mut state: u32 = 0x9e37_79b9;
let rgba: Vec<u8> = (0..64 * 64 * 4)
.map(|_| {
state = state.wrapping_mul(1_664_525).wrapping_add(1_013_904_... |
rust_dataset_chunk_512960 | rust_dataset.txt | 512,960 | 512 | b}\\";
assert!(output.contains(placement));
let save_position = output.find("\u{1b}[s").unwrap();
let transmit_position = output.find("\u{1b}_Ga=t").unwrap();
let restore_position = output.rfind("\u{1b}[u").unwrap();
assert!(save_position < transmit_position);
assert!(transmit_position < restore... |
rust_dataset_chunk_512961 | rust_dataset.txt | 512,961 | 512 | licit_mark_does_not_invalidate_host_state() {
let parts = create_test_kitty_parts();
let internal = store_test_kitty_image(&parts.0, 30, 40);
let frame_1 = run_kitty_frame(&parts, vec![kitty_chunk(internal, 1, 0, 0)], None);
assert_eq!(frame_1.matches("\u{1b}_Ga=t").count(), 1);
let frame_2 =
... |
rust_dataset_chunk_512962 | rust_dataset.txt | 512,962 | 512 | u{1b}_Ga=d,q=2,d=I,i=2000000000\u{1b}\\"));
let new_internal = store_test_kitty_image(&parts.0, 30, 40);
let frame_5 = run_kitty_frame(&parts, vec![kitty_chunk(new_internal, 2, 0, 0)], None);
assert!(frame_5.contains("\u{1b}_Ga=t,q=2,f=32,o=z,t=d,i=2000000001,"));
}
#[test]
fn kitty_placements_of_pane_drop... |
rust_dataset_chunk_512963 | rust_dataset.txt | 512,963 | 512 | _exclude_covered_quarter() {
let parts = create_test_kitty_parts();
let internal = store_test_kitty_image(&parts.0, 40, 80);
let pane_geom = create_pane_geom(2, 0, 2, 2);
let floating_panes_stack = FloatingPanesStack {
layers: vec![pane_geom],
};
let mut chunk = kitty_chunk(internal, 1, ... |
rust_dataset_chunk_512964 | rust_dataset.txt | 512,964 | 512 | {
let parts_with_false = create_test_kitty_parts();
parts_with_false
.1
.borrow_mut()
.insert(1, KittyHostCapability::default());
let internal = store_test_kitty_image(&parts_with_false.0, 30, 40);
let output = run_kitty_frame(
&parts_with_false,
vec![kitty_chunk... |
rust_dataset_chunk_512965 | rust_dataset.txt | 512,965 | 512 | : &str) -> Vec<Vec<u8>> {
let bytes = output.as_bytes();
let mut commands = Vec::new();
let mut index = 0;
while index < bytes.len() {
if bytes[index] == 0x1b
&& index + 2 < bytes.len()
&& bytes[index + 1] == b'_'
&& bytes[index + 2] == b'G'
{
... |
rust_dataset_chunk_512966 | rust_dataset.txt | 512,966 | 512 | ::Display => placement = Some(command),
_ => {},
},
Some(Err(err)) => panic!("emitted command failed to parse: {:?}", err.code),
None => {},
}
}
let (width, height, format, byte_len) =
decoded_image.expect("transmit round-trip produced no deco... |
rust_dataset_chunk_512967 | rust_dataset.txt | 512,967 | 512 | acements_preserve_pixels_after_cell_resize() {
use crate::panes::kitty_graphics::grid_state::{KittyGrid, KittyVerticalAnchor};
use crate::panes::kitty_graphics::parser::KittyCommand;
let colors = [
[255, 0, 0, 255],
[0, 255, 0, 255],
[0, 0, 255, 255],
[255; 4],
];
fo... |
rust_dataset_chunk_512968 | rust_dataset.txt | 512,968 | 512 | ();
for size in [(10, 20), (15, 30)] {
*cell.borrow_mut() = Some(SizeInPixels {
width: size.0,
height: size.1,
});
grid.character_cell_size_possibly_changed();
let chunks = grid.viewport_kitty_chunks(20, 0, 50, 0, 0);
le... |
rust_dataset_chunk_512969 | rust_dataset.txt | 512,969 | 512 | ;
use crate::panes::terminal_character::CursorShape;
use zellij_utils::structured_render::{
CURSOR_BLINKING, CURSOR_SHAPE_BEAM, CURSOR_SHAPE_BLOCK, CURSOR_SHAPE_DEFAULT,
CURSOR_SHAPE_UNDERLINE,
};
fn wire(shape: CursorShape) -> u8 {
wire_cursor_shape(shape.get_csi_str())
}
... |
rust_dataset_chunk_512970 | rust_dataset.txt | 512,970 | 512 | rc::Rc;
use zellij_utils::pane_size::{Size, SizeInPixels};
use zellij_utils::structured_render::{decode, LinkEntry};
const CLIENT: ClientId = 1;
struct Harness {
output: Output,
links: Rc<RefCell<LinkHandler>>,
clients: Rc<RefCell<HashMap<ClientId, StructuredClientState>>>,
... |
rust_dataset_chunk_512971 | rust_dataset.txt | 512,971 | 512 | ,
x: usize,
runs: &[(&str, Option<RcCharacterStyles>)],
) -> CharacterChunk {
let mut characters = Vec::new();
for (text, styles) in runs {
for character in text.chars() {
characters.push(match styles {
S... |
rust_dataset_chunk_512972 | rust_dataset.txt | 512,972 | 512 | 20);
let anchor = harness.anchor("id=1", "https://example.com/one");
let chunk = harness.chunk(0, 0, &[("ab", Some(anchor)), (" cd", None)]);
let frame = harness.frame(vec![chunk]);
assert_eq!(&frame.row(0)[..5], &[1, 1, 0, 0, 0]);
assert_eq!(frame.uri(1), Some("https://example.... |
rust_dataset_chunk_512973 | rust_dataset.txt | 512,973 | 512 | ),
("ef", Some(third)),
],
);
let frame = harness.frame(vec![chunk]);
assert_eq!(&frame.row(0)[..10], &[1, 1, 0, 0, 1, 1, 0, 0, 1, 1]);
assert_eq!(frame.table.len(), 1);
}
#[test]
fn an_auto_detected_url_travels_like_any_other_link() {
le... |
rust_dataset_chunk_512974 | rust_dataset.txt | 512,974 | 512 | = harness.frame(vec![chunk]);
assert_eq!(
frame.uri(2),
Some("https://example.com/second"),
"the first id is still on screen, so the second link gets its own"
);
let chunk = harness.chunk(0, 0, &[("ef", None)]);
harness.frame(vec![chunk]);
l... |
rust_dataset_chunk_512975 | rust_dataset.txt | 512,975 | 512 | 0, 0, 0]);
}
#[test]
fn a_full_repaint_starts_a_new_generation_and_restates_the_table() {
let mut harness = Harness::new(1, 20);
let anchor = harness.anchor("", "https://example.com/kept");
let chunk = harness.chunk(0, 0, &[("ab", Some(anchor.clone()))]);
assert_eq!(harness.... |
rust_dataset_chunk_512976 | rust_dataset.txt | 512,976 | 512 | () {
let emitted = format!("{}", RESET_STYLES.blink_fast(Some(AnsiCode::On)));
let at = emitted.find("\u{1b}[6m").expect("the fast blink code");
assert!(!emitted[at..].contains("\u{1b}[25m"), "{:?}", emitted);
assert_eq!(emitted.matches("\u{1b}[25m").count(), 1, "{:?}", emitted);
}
... |
rust_dataset_chunk_512977 | rust_dataset.txt | 512,977 | 512 | entries: entries
.iter()
.map(|&(pane, lines)| ScrollEntry { pane, lines })
.collect(),
}
}
#[test]
fn a_pane_seen_for_the_first_time_has_no_hint() {
let mut tracked: HashMap<PaneId, TrackedScroll> = HashMap::new();
assert!... |
rust_dataset_chunk_512978 | rust_dataset.txt | 512,978 | 512 | &[pane(1, 20, None)], false).is_empty());
assert!(scroll_hints(&mut tracked, &[pane(1, 20, Some((4, 0)))], false).is_empty());
}
#[test]
fn a_pane_that_disappears_and_returns_has_no_hint() {
let mut tracked = HashMap::new();
scroll_hints(&mut tracked, &[pane(1, 20, Some((0, 0)))], ... |
rust_dataset_chunk_512979 | rust_dataset.txt | 512,979 | 512 | chunk = CharacterChunk::new(cells, x, y);
chunk.may_have_groups = true;
chunk
}
#[test]
fn a_plain_ascii_chunk_serializes_exactly_as_before() {
let output = ansi_for(create_character_chunk_from_str("abc", 2, 1), None);
assert_eq!(output, "\u{1b}[2;3H\u{1b}[mabc");
}
#[test]
fn a_cell_with_combining_m... |
rust_dataset_chunk_512980 | rust_dataset.txt | 512,980 | 512 | fn skin_tone_flag_and_conjunct_groups_are_complex_units() {
for (parts, text, columns) in [
(
vec![("\u{1F44D}", 2), ("\u{1F3FD}", 2)],
"\u{1F44D}\u{1F3FD}",
4,
),
(
vec![("\u{1F1E9}", 1), ("\u{1F1EA}", 1)],
"\u{1F1E9}\u{1F1EA}",
... |
rust_dataset_chunk_512981 | rust_dataset.txt | 512,981 | 512 | '), "output={:?}", output);
assert!(output.ends_with("\u{1F468}\u{200D}x\u{1F467}"));
}
#[test]
fn a_selection_covering_a_group_keeps_it_grouped() {
let mut chunk = grouped_chunk(family_cells(), 0, 0);
let mut selection = crate::panes::Selection::default();
selection.start(zellij_utils::position::Posit... |
rust_dataset_chunk_512982 | rust_dataset.txt | 512,982 | 512 | = chunk.cut_middle_out(1, 3).unwrap();
assert_eq!(left.iter().map(|c| c.width()).sum::<usize>(), 1);
assert_eq!(right.iter().map(|c| c.width()).sum::<usize>(), 3);
assert!(left.iter().all(|c| c.text() == " "));
assert_eq!(text(&right), " \u{1F467}");
}
#[test]
fn draining_across_a_width_three_cell_pad... |
rust_dataset_chunk_512983 | rust_dataset.txt | 512,983 | 512 | row = Row::from_columns(family_cells());
row.may_have_groups = true;
let row = row.canonical();
let output = OutputBuffer::default()
.serialize(&[row], true, None)
.unwrap();
assert!(output.contains(FAMILY), "output={:?}", output);
assert!(!output.contains("\u{1b}[6X"));
assert!... |
rust_dataset_chunk_512984 | rust_dataset.txt | 512,984 | 512 | }");
assert_eq!(row[7].text(&clusters), "e\u{0301}");
assert_eq!(row[8].width, 3);
assert_eq!(row[11].text(&clusters), "z");
let screen = watcher_text(&frame, watcher_size.cols, watcher_size.rows);
assert!(screen[0].starts_with(&format!(
"\u{1F468}\u{200D} \u{1F469}\u{200D} \u{1F467} \u{26A0... |
rust_dataset_chunk_512985 | rust_dataset.txt | 512,985 | 512 | ::{HashMap, HashSet};
use zellij_utils::data::FloatingPaneCoordinates;
use zellij_utils::input::layout::{PercentOrFixed, RunPluginOrAlias};
use zellij_utils::pane_size::Size;
use crate::{panes::PaneId, pty::PtyInstruction, thread_bus::ThreadSenders, ClientId};
pub struct PaneGroups {
panes_in_group: HashMap<Clie... |
rust_dataset_chunk_512986 | rust_dataset.txt | 512,986 | 512 | screen_size: Size,
client_id: &ClientId,
) {
let previous_groups = self.clone_inner();
let client_pane_group = self
.panes_in_group
.entry(*client_id)
.or_insert_with(|| vec![]);
if !client_pane_group.contains(&pane_id) {
client... |
rust_dataset_chunk_512987 | rust_dataset.txt | 512,987 | 512 | HashMap<ClientId, Vec<PaneId>>) {
self.panes_in_group = new_pane_groups;
}
fn should_launch_plugin(
&self,
previous_groups: &HashMap<ClientId, Vec<PaneId>>,
client_id: &ClientId,
) -> bool {
let mut should_launch = false;
for (client_id, previous_panes) in pr... |
rust_dataset_chunk_512988 | rust_dataset.txt | 512,988 | 512 | // close_replaced_pane
pane_title,
run_plugin,
tab_index,
None,
*client_id,
size,
skip_cache,
cwd,
should_focus_plugin,
Some(floating_pane_coordinates),
... |
rust_dataset_chunk_512989 | rust_dataset.txt | 512,989 | 512 | );
}
let result = pane_groups.get_client_pane_group(&client_id);
assert_eq!(result.len(), 3);
for pane_id in pane_ids {
assert!(result.contains(&pane_id));
}
}
#[test]
fn clear_pane_group_clears_existing_group() {
let mut pane_groups = create_tes... |
rust_dataset_chunk_512990 | rust_dataset.txt | 512,990 | 512 | assert!(!pane_groups
.get_client_pane_group(&client_id)
.contains(&pane_id));
}
#[test]
fn add_pane_id_to_group_adds_new_pane() {
let mut pane_groups = create_test_pane_groups();
let client_id: ClientId = 1;
let pane_id = PaneId::Terminal(10);
... |
rust_dataset_chunk_512991 | rust_dataset.txt | 512,991 | 512 | PaneId::Terminal(5)));
assert!(!result.contains(&PaneId::Plugin(2)));
assert!(!result.contains(&PaneId::Terminal(3)));
assert_eq!(result.len(), 3);
}
#[test]
fn override_groups_with_replaces_all_groups() {
let mut pane_groups = create_test_pane_groups();
let client_i... |
rust_dataset_chunk_512992 | rust_dataset.txt | 512,992 | 512 | );
let plugin_pane = PaneId::Plugin(200);
pane_groups.add_pane_id_to_group(terminal_pane, screen_size, &client_id);
pane_groups.add_pane_id_to_group(plugin_pane, screen_size, &client_id);
let result = pane_groups.get_client_pane_group(&client_id);
assert!(result.contains(&termi... |
rust_dataset_chunk_512993 | rust_dataset.txt | 512,993 | 512 | _groups, &client_id));
}
#[test]
fn should_launch_plugin_returns_false_when_empty_to_empty() {
let pane_groups = create_test_pane_groups();
let client_id: ClientId = 1;
let mut previous_groups = HashMap::new();
previous_groups.insert(client_id, vec![]);
assert!(!pa... |
rust_dataset_chunk_512994 | rust_dataset.txt | 512,994 | 512 | amped.y,
..clamped
}
}
pub fn is_empty(&self) -> bool {
self.cols == 0 || self.rows == 0
}
pub fn contains(&self, column: usize, line: usize) -> bool {
column >= self.x
&& column < self.x + self.cols
&& line >= self.y
&& line < se... |
rust_dataset_chunk_512995 | rust_dataset.txt | 512,995 | 512 | Underline(None),
UNDERLINE_DOUBLE => AnsiCode::Underline(Some(AnsiStyledUnderline::Double)),
UNDERLINE_CURLY => AnsiCode::Underline(Some(AnsiStyledUnderline::Undercurl)),
UNDERLINE_DOTTED => AnsiCode::Underline(Some(AnsiStyledUnderline::Underdotted)),
UNDERLINE_DASHED => AnsiCode::Underl... |
rust_dataset_chunk_512996 | rust_dataset.txt | 512,996 | 512 | 16,
x: usize,
y: usize,
cols: usize,
link_for: &mut dyn FnMut(&str) -> Option<LinkAnchor>,
styled_underlines: bool,
) -> CharacterChunk {
let cells = screen.row(row);
let mut characters = Vec::with_capacity(cols);
let mut may_have_groups = false;
let mut column = 0;
while column ... |
rust_dataset_chunk_512997 | rust_dataset.txt | 512,997 | 512 | visible_cursor_row(screen) {
Some(cursor) => cursor.max(content),
None => content,
}
}
pub fn screen_offset(screen: &MirrorScreen, view_rows: usize) -> usize {
let offset = row_offset(screen.rows as usize, anchor_row(screen), view_rows);
match visible_cursor_row(screen) {
Some(curs... |
rust_dataset_chunk_512998 | rust_dataset.txt | 512,998 | 512 | .push(character);
}
(out, used)
}
pub fn placeholder_chunks(lines: &[String], area: &LiveViewRect) -> Vec<CharacterChunk> {
if area.is_empty() {
return vec![];
}
let first_row = area.rows.saturating_sub(lines.len()) / 2;
(0..area.rows)
.map(|row| {
let line = row
... |
rust_dataset_chunk_512999 | rust_dataset.txt | 512,999 | 512 | u{1b}[6 q",
_ => "\u{1b}[0 q",
}
}
#[cfg(test)]
#[path = "./unit/cells_tests.rs"]
mod cells_tests;
--- FILE: zellij/zellij-server/src/pane_mirror/live_view.rs ---
use super::cells::{
cursor_shape_csi, placeholder_chunks, screen_chunks_from, screen_offset, LiveViewRect,
};
use super::view::{MirrorRedr... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.