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_513600 | rust_dataset.txt | 513,600 | 512 | _border = pane.y();
let lower_close_border = pane.y() + pane.rows();
let panes_to_the_left = self.pane_ids_directly_next_to(&id, &Direction::Left)?;
let mut selectable_panes: Vec<_> = panes_to_the_left
.into_iter()
.filter(|pid| panes.get(pid).map(|p|... |
rust_dataset_chunk_513601 | rust_dataset.txt | 513,601 | 512 | = pane.x();
let right_close_border = pane.x() + pane.cols();
let panes_above = self.pane_ids_directly_next_to(&id, &Direction::Up)?;
let mut selectable_panes: Vec<_> = panes_above
.into_iter()
.filter(|pid| panes.get(pid).map(|p| p.selectable()).unwr... |
rust_dataset_chunk_513602 | rust_dataset.txt | 513,602 | 512 | , SplitDirection::Horizontal)));
}
let vertical = match self.panes_above_between_aligning_borders(id)? {
Some(panes) => Some(panes),
None => self.panes_below_between_aligning_borders(id)?,
};
Ok(vertical.map(|panes| (panes, SplitDirection::Vertical)))
}
f... |
rust_dataset_chunk_513603 | rust_dataset.txt | 513,603 | 512 | = (freed_width, freed_height) {
match self.find_panes_to_grow(id) {
Ok(Some((panes_to_grow, direction))) => {
self.grow_panes(&panes_to_grow, direction, (freed_width, freed_height));
let side_length = match direction {
SplitDir... |
rust_dataset_chunk_513604 | rust_dataset.txt | 513,604 | 512 | 2));
if pane_can_be_split && pane_size > current_largest_pane_size {
(pane_size, Some(*id_of_pane_to_check))
} else {
(current_largest_pane_size, current_pane_id_to_split)
}
},
);
pane_id_to_split.and_the... |
rust_dataset_chunk_513605 | rust_dataset.txt | 513,605 | 512 | p.current_geom().is_stacked() && !p.current_geom().rows.is_fixed()
})
.collect();
flexible_pane_in_stack
.iter()
.any(|(_p_id, p)| p.current_geom().rows.as_usize() > MIN_TERMINAL_HEIGHT)
}
pub fn room_left_in_stack_of_pane_id(&mut self, pane_id: &PaneId) ... |
rust_dataset_chunk_513606 | rust_dataset.txt | 513,606 | 512 | pane.position_and_size();
let previous_highest_y = highest_pane_y;
highest_pane_y = std::cmp::max(pane_geom.y, highest_pane_y);
if previous_highest_y != highest_pane_y {
second_group.append(&mut first_group);
}
if pane_... |
rust_dataset_chunk_513607 | rust_dataset.txt | 513,607 | 512 | = pane.position_and_size();
let previous_lowest_row_count =
lowest_row_count.unwrap_or_else(|| pane_geom.rows.as_usize());
lowest_row_count = Some(std::cmp::min(
pane_geom.rows.as_usize(),
lowest_row_count.unwrap_or_else(|| pan... |
rust_dataset_chunk_513608 | rust_dataset.txt | 513,608 | 512 | match pane_x {
Some(pane_x) => {
if pane_x != pane.position_and_size().x {
panes_all_have_the_same_x = false;
}
},
None => {
pane_x = Some(pane.position_and_si... |
rust_dataset_chunk_513609 | rust_dataset.txt | 513,609 | 512 | _pane_id, Direction::Up).ok()
else {
log::error!("Could not find neighbor pane ids above");
return vec![];
};
let neighbor_pane_ids = neighbor_pane_ids
.iter()
.filter(|pane_id| {
self.pane_is_between_vertical_borders(
... |
rust_dataset_chunk_513610 | rust_dataset.txt | 513,610 | 512 | in the pane_ids_to_expand over the holes horizontally and then shorten the
// height of the holes by the pane_ids_to_expand (squeeze them upwards)
// we expect the pane_ids_to_expand to all have the same y and height and for the holes to
// all be higher
let err_context = || format!("Fa... |
rust_dataset_chunk_513611 | rust_dataset.txt | 513,611 | 512 | .get_mut(&hole_id)
.with_context(err_context)?
.set_geom(hole_geom);
}
if let Some((hole_id, mut hole_geom)) = uncovered_hole {
let (pane_id_with_closest_x, mut pane_geom_with_closest_x) =
panes_to_expand.last().with_context(err... |
rust_dataset_chunk_513612 | rust_dataset.txt | 513,612 | 512 | a_geom.x.cmp(&b_geom.x));
hole_panes.sort_by(|(_a_id, a_geom), (_b_id, b_geom)| a_geom.x.cmp(&b_geom.x));
let mut uncovered_hole = None;
for (hole_id, mut hole_geom) in hole_panes {
let hole_x = hole_geom.x;
let Some((pane_id_with_closest_x, mut pane_geom_with_closest_x)... |
rust_dataset_chunk_513613 | rust_dataset.txt | 513,613 | 512 | ()
.get_mut(&hole_id)
.with_context(err_context)?
.set_geom(hole_geom);
}
Ok(())
}
fn fill_geom_holes_vertically_to_the_right(
&mut self,
pane_ids_to_expand: &[PaneId],
holes: &[PaneId],
) -> Result<()> {
// here... |
rust_dataset_chunk_513614 | rust_dataset.txt | 513,614 | 512 | ;
hole_geom.cols.reduce_by(
pane_geom_with_closest_y
.cols
.as_percent()
.with_context(err_context)?,
pane_geom_with_closest_y.cols.as_usize(),
);
hole_geom.x += pane_geom_with_closest_y.cols.... |
rust_dataset_chunk_513615 | rust_dataset.txt | 513,615 | 512 | _to_expand {
let panes = self.panes.borrow();
let pane = panes.get(&p_id).with_context(err_context)?;
panes_to_expand.push((p_id, pane.position_and_size()));
}
for p_id in holes {
let panes = self.panes.borrow();
let pane = panes.get(&p_id).wit... |
rust_dataset_chunk_513616 | rust_dataset.txt | 513,616 | 512 | _closest_y
.cols
.as_percent()
.with_context(err_context)?,
pane_geom_with_closest_y.cols.as_usize(),
);
self.panes
.borrow_mut()
.get_mut(&pane_id_with_closest_y)
.with_co... |
rust_dataset_chunk_513617 | rust_dataset.txt | 513,617 | 512 | ane_id: &PaneId) -> Vec<PaneId> {
// here we look for panes that are directly below the provided root pane but that do not
// exceed its vertical borders (x and x + cols)
let Some(root_pane_geom) = self.get_pane_geom(root_pane_id) else {
log::error!("Could nto find root pane geom");
... |
rust_dataset_chunk_513618 | rust_dataset.txt | 513,618 | 512 | if let Err(e) = self
.fill_geom_holes_horizontally_downwards(&panes_with_lowest_rows, &leftover_panes)
{
log::error!("Failed to fill_geom_holes_horizontally downwards: {}", e);
return None;
}
neighboring_pane_ids_below = pan... |
rust_dataset_chunk_513619 | rust_dataset.txt | 513,619 | 512 | _of_pane_ids.contains(&(root_pane_geom.y + root_pane_geom.rows.as_usize()))
{
neighbor_pane_ids
} else {
vec![]
}
}
pub fn stack_pane_left(&mut self, pane_id: &PaneId) -> Option<Vec<PaneId>> {
let mut neighboring_pane_ids_to_the_left =
self.dir... |
rust_dataset_chunk_513620 | rust_dataset.txt | 513,620 | 512 | filter(|pane_id| {
self.pane_is_between_horizontal_borders(
pane_id,
root_pane_geom.y,
root_pane_geom.y + root_pane_geom.rows.as_usize(),
)
})
.copied()
.collect::<Vec<_>>();
// we onl... |
rust_dataset_chunk_513621 | rust_dataset.txt | 513,621 | 512 | .non_fatal();
Some(vec![*pane_id])
}
fn pane_ids_are_all_selectable(&self, pane_ids: &[PaneId]) -> bool {
let panes = self.panes.borrow();
!pane_ids.is_empty()
&& pane_ids
.iter()
.all(|p| panes.get(p).map(|pane| pane.selectable()).... |
rust_dataset_chunk_513622 | rust_dataset.txt | 513,622 | 512 | => PaneGeom {
y: first_rect.y + 1,
rows: first_rect.rows,
logical_position: None,
..*rect
},
};
Some((first_rect, second_rect))
} else {
None
}
}
--- FILE: zellij/zellij-server/src/panes/tiled_panes/unit/mock_... |
rust_dataset_chunk_513623 | rust_dataset.txt | 513,623 | 512 | _position: None,
geom_override: None,
}
}
pub fn spec_stacked(
id: u32,
x: usize,
y: usize,
cols: Dimension,
rows: Dimension,
stack_id: usize,
) -> PaneSpec {
PaneSpec {
id: PaneId::Terminal(id),
x,
y,
cols,
rows,
stacked: Some(sta... |
rust_dataset_chunk_513624 | rust_dataset.txt | 513,624 | 512 | ,
_ => Outcome::OtherErr(format!("{:#}", e)),
},
};
let mut panes: Vec<PaneSnapshot> = map
.borrow()
.iter()
.map(|(id, p)| PaneSnapshot {
id: *id,
geom: p.position_and_size(),
current: p.current_geom(),
geom_override: ... |
rust_dataset_chunk_513625 | rust_dataset.txt | 513,625 | 512 | fn set_should_render_boundaries(&mut self, _should_render: bool) {
unimplemented!()
}
fn selectable(&self) -> bool {
unimplemented!()
}
fn set_selectable(&mut self, _selectable: bool) {
unimplemented!()
}
fn render(
&mut self,
_client_id: Option<Client... |
rust_dataset_chunk_513626 | rust_dataset.txt | 513,626 | 512 | scroll_down(&mut self, _count: usize, _client_id: ClientId) {
unimplemented!()
}
fn scroll_left(&mut self, _count: usize, _client_id: ClientId) {}
fn scroll_right(&mut self, _count: usize, _client_id: ClientId) {}
fn clear_scroll(&mut self) {
unimplemented!()
}
fn is_scrolled(&s... |
rust_dataset_chunk_513627 | rust_dataset.txt | 513,627 | 512 | FILE: zellij/zellij-server/src/panes/tiled_panes/unit/pane_resizer_tests.rs ---
#![allow(dead_code)]
use super::pane_resizer_test_mock::{
dim_fixed, dim_pct, run_layout, spec, spec_stacked, with_override, Outcome, PaneSnapshot,
PaneSpec, Run,
};
use crate::panes::PaneId;
use zellij_utils::input::layout::Split... |
rust_dataset_chunk_513628 | rust_dataset.txt | 513,628 | 512 | 10)),
spec(2, 40, 0, dim_pct(50.0, 40), dim_pct(100.0, 10)),
],
direction: h,
space: 100,
class: Class::A,
bands: vec![],
},
Fixture {
name: "identical_sizes_report_unchanged",
specs: vec![
... |
rust_dataset_chunk_513629 | rust_dataset.txt | 513,629 | 512 | 100,
class: Class::A,
bands: vec![],
},
Fixture {
name: "over_rounded_band_shrinks_last",
specs: vec![
spec(1, 0, 0, dim_pct(33.4999, 33), dim_pct(100.0, 10)),
spec(2, 33, 0, dim_pct(33.4999, 33), dim_pct(100.0, 10)),
... |
rust_dataset_chunk_513630 | rust_dataset.txt | 513,630 | 512 | ), dim_pct(50.0, 10)),
spec(5, 13, 10, dim_pct(16.65, 13), dim_pct(50.0, 10)),
],
direction: h,
space: 100,
class: Class::A,
bands: vec![],
},
Fixture {
name: "stack_main_pane_carries_whole_stack",
specs:... |
rust_dataset_chunk_513631 | rust_dataset.txt | 513,631 | 512 | A,
bands: vec![],
},
Fixture {
name: "no_room_for_all_spans",
specs: vec![
spec(1, 0, 0, dim_pct(50.0, 40), dim_pct(100.0, 10)),
spec(2, 40, 0, dim_pct(50.0, 40), dim_pct(100.0, 10)),
],
direction: h,
... |
rust_dataset_chunk_513632 | rust_dataset.txt | 513,632 | 512 | class: Class::B,
bands: vec![vec![tid(1), tid(2)]],
},
Fixture {
name: "degenerate_across_two_bands",
specs: vec![
spec(1, 0, 0, dim_pct(60.0, 26), dim_pct(50.0, 10)),
spec(3, 26, 0, dim_pct(60.0, 54), dim_pct(100.0, 20)),
... |
rust_dataset_chunk_513633 | rust_dataset.txt | 513,633 | 512 | dim_pct(100.0, 10)),
spec(2, 30, 0, dim_pct(50.0, 20), dim_pct(100.0, 10)),
],
direction: h,
space: 20,
class: Class::Artefact,
bands: vec![],
},
Fixture {
name: "stacked_pane_with_override",
specs: {
... |
rust_dataset_chunk_513634 | rust_dataset.txt | 513,634 | 512 | !(
actual.cols.as_usize(),
expected.cols.as_usize(),
"{}: cols.inner",
ctx
);
assert_eq!(
actual.rows.constraint, expected.rows.constraint,
"{}: rows.constraint",
ctx
);
assert_eq!(
actual.rows.as_usize(),
expected.rows.as_usize(),
... |
rust_dataset_chunk_513635 | rust_dataset.txt | 513,635 | 512 | snapshot.id
);
assert_eq!(
snapshot.current.rows.as_usize(),
expected.rows.as_usize(),
"fixture `{}`: {:?} rows.inner",
name,
snapshot.id
);
},
Axi... |
rust_dataset_chunk_513636 | rust_dataset.txt | 513,636 | 512 | ) {
let mut members: Vec<(usize, usize)> = band
.iter()
.map(|id| {
let snapshot = run
.panes
.iter()
.find(|p| p.id == *id)
.unwrap_or_else(|| panic!("fixture `{}`: no snapshot for {:?}", name, id));
let (pos, s... |
rust_dataset_chunk_513637 | rust_dataset.txt | 513,637 | 512 | ?}",
name, snapshot.id, actual, expected
),
}
}
}
fn assert_class_b_invariants(fixture: &Fixture, run: &Run) {
let axis = fixture.axis();
assert_result_is_benign(run, fixture.name);
assert_constraints_preserved(run, &fixture.specs, axis, fixture.name);
if !fixtur... |
rust_dataset_chunk_513638 | rust_dataset.txt | 513,638 | 512 | assert_eq!(p.geom.cols.constraint, Constraint::Percent(100.0));
assert_eq!(p.geom.cols.as_usize(), 80);
assert_eq!(p.geom.y, 0);
assert_eq!(p.geom.rows.constraint, Constraint::Percent(100.0));
assert_eq!(p.geom.rows.as_usize(), 10);
}
#[test]
fn empty_pane_map_reports_unchanged() {
let f = fixt... |
rust_dataset_chunk_513639 | rust_dataset.txt | 513,639 | 512 | (), 80);
assert_eq!(two.geom.x, 0);
assert_eq!(two.geom.cols.as_usize(), 80);
}
#[test]
fn three_panes_round_up_first() {
let f = fixture("three_panes_round_up_first");
let run = f.run();
assert_ok(&run, f.name);
let sizes: Vec<usize> = [1, 2, 3]
.iter()
.map(|id| pane(&run, *id... |
rust_dataset_chunk_513640 | rust_dataset.txt | 513,640 | 512 | assert_eq!(two.geom.cols.as_usize(), 80);
}
#[test]
fn fixed_pane_excluded_from_rounding() {
let f = fixture("fixed_pane_excluded_from_rounding");
let run = f.run();
assert_ok(&run, f.name);
let sizes: Vec<usize> = [1, 2, 3]
.iter()
.map(|id| pane(&run, *id).geom.cols.as_usize())
... |
rust_dataset_chunk_513641 | rust_dataset.txt | 513,641 | 512 | orts_without_error() {
let f = fixture("short_stack_aborts_without_error");
let run = f.run();
assert_ok(&run, f.name);
assert_no_mutation(&run, &f.specs, f.name);
}
#[test]
fn override_pane_updates_override_only() {
let f = fixture("override_pane_updates_override_only");
let run = f.run();
... |
rust_dataset_chunk_513642 | rust_dataset.txt | 513,642 | 512 | _flexible_pane_is_ignored");
let run = f.run();
assert_eq!(run.outcome, Outcome::PaneSizeUnchanged);
assert_no_mutation(&run, &f.specs, f.name);
}
#[test]
fn under_specified_percents() {
let f = fixture("under_specified_percents");
assert_class_b_invariants(&f, &f.run());
}
#[test]
fn over_specifi... |
rust_dataset_chunk_513643 | rust_dataset.txt | 513,643 | 512 | ), dim_fixed(1)),
spec(2, 0, 1, dim_pct(100.0, 20), dim_pct(100.0, 5)),
spec(3, 0, 6, dim_pct(100.0, 20), dim_fixed(2)),
];
let run = run_layout(&specs, SplitDirection::Vertical, 3);
assert_eq!(
run.outcome,
Outcome::OtherErr("Ran out of room for spans".to_owned())
);
... |
rust_dataset_chunk_513644 | rust_dataset.txt | 513,644 | 512 | :expr, $y:expr, $logical_position:expr, $mock_panes:expr) => {
let mut mock_pane_rows = $rows_dimension;
mock_pane_rows.set_inner($rows_inner);
let mut mock_pane_cols = $cols_dimension;
mock_pane_cols.set_inner($cols_inner);
let mut mock_pane: Box<dyn Pane> = Box::new(MockPane::n... |
rust_dataset_chunk_513645 | rust_dataset.txt | 513,645 | 512 | stack_id:expr) => {
let mut mock_pane_rows = $dimension;
mock_pane_rows.set_inner($inner);
let mut mock_pane: Box<dyn Pane> = Box::new(MockPane::new(PaneGeom {
x: $x,
y: $y,
rows: mock_pane_rows,
cols: Dimension::percent(100.0),
logical... |
rust_dataset_chunk_513646 | rust_dataset.txt | 513,646 | 512 | .clone())
.combine_vertically_aligned_panes_to_stack(&pane_id_above, vec![pane_id_below])
.unwrap();
let mut pane_geoms_after: Vec<PaneGeom> = mock_panes
.borrow()
.values()
.map(|p| p.current_geom())
.collect();
pane_geoms_after.sort_by(|a, b| a.logical_position.... |
rust_dataset_chunk_513647 | rust_dataset.txt | 513,647 | 512 | _pane_is_on_top_of_stack(
) {
let mut mock_panes: HashMap<PaneId, &mut Box<dyn Pane>> = HashMap::new();
mock_pane!(
PaneId::Terminal(1),
Dimension::percent(33.3),
33,
0,
0,
Some(1),
mock_panes
);
mock_pane!(
PaneId::Terminal(2),
Di... |
rust_dataset_chunk_513648 | rust_dataset.txt | 513,648 | 512 | 2),
mock_panes
);
mock_stacked_pane!(
PaneId::Terminal(3),
Dimension::fixed(1),
1,
0,
66,
Some(3),
mock_panes
);
mock_stacked_pane!(
PaneId::Terminal(4),
Dimension::percent(33.3),
32,
0,
67,
S... |
rust_dataset_chunk_513649 | rust_dataset.txt | 513,649 | 512 | _with_id!(
PaneId::Terminal(4),
Dimension::percent(50.0),
48,
0,
51,
Some(4),
mock_panes,
1
);
mock_stacked_pane_with_id!(
PaneId::Terminal(5),
Dimension::fixed(1),
1,
0,
99,
Some(5),
mock_pan... |
rust_dataset_chunk_513650 | rust_dataset.txt | 513,650 | 512 | Some(4),
mock_panes,
1
);
mock_stacked_pane_with_id!(
PaneId::Terminal(5),
Dimension::fixed(1),
1,
0,
99,
Some(5),
mock_panes,
1
);
let mock_panes = Rc::new(RefCell::new(mock_panes));
let root_pane_id = PaneId::... |
rust_dataset_chunk_513651 | rust_dataset.txt | 513,651 | 512 | 4),
mock_panes,
1
);
mock_stacked_pane_with_id!(
PaneId::Terminal(5),
Dimension::percent(50.0),
48,
0,
51,
Some(5),
mock_panes,
1
);
mock_stacked_pane_with_id!(
PaneId::Terminal(6),
Dimension::fixed(1),
... |
rust_dataset_chunk_513652 | rust_dataset.txt | 513,652 | 512 | ::new(RefCell::new(mock_panes));
let pane_id_of_main_stack = PaneId::Terminal(1);
let neighboring_pane_ids = vec![PaneId::Terminal(2), PaneId::Terminal(3)];
StackedPanes::new(mock_panes.clone())
.combine_horizontally_aligned_panes_to_stack(&pane_id_of_main_stack, neighboring_pane_ids)
.unwr... |
rust_dataset_chunk_513653 | rust_dataset.txt | 513,653 | 512 | 50,
50,
Some(5),
mock_panes
);
let mock_panes = Rc::new(RefCell::new(mock_panes));
let pane_id_of_main_stack = PaneId::Terminal(1);
let neighboring_pane_ids = vec![PaneId::Terminal(4), PaneId::Terminal(5)];
StackedPanes::new(mock_panes.clone())
.combine_hori... |
rust_dataset_chunk_513654 | rust_dataset.txt | 513,654 | 512 | ),
Dimension::percent(50.0),
50,
Dimension::percent(50.0),
50,
0,
50,
Some(5),
mock_panes
);
let mock_panes = Rc::new(RefCell::new(mock_panes));
let pane_id_of_main_stack = PaneId::Terminal(1);
let neighboring_pane_ids = vec![PaneId::Termi... |
rust_dataset_chunk_513655 | rust_dataset.txt | 513,655 | 512 | Terminal(3);
// here the bottom pane should be broken out because the focused pane is the top one and should
// remain in the stack
StackedPanes::new(mock_panes.clone())
.break_pane_out_of_stack(&focused_pane)
.unwrap();
let mut pane_geoms_after: Vec<PaneGeom> = mock_panes
.borr... |
rust_dataset_chunk_513656 | rust_dataset.txt | 513,656 | 512 | .current_geom())
.collect();
pane_geoms_after.sort_by(|a, b| a.logical_position.cmp(&b.logical_position));
assert_snapshot!(format!("{:#?}", pane_geoms_after));
}
#[test]
fn break_pane_out_of_stack_bottom() {
let mut mock_panes: HashMap<PaneId, &mut Box<dyn Pane>> = HashMap::new();
mock_pane!(... |
rust_dataset_chunk_513657 | rust_dataset.txt | 513,657 | 512 | ::new();
mock_pane!(
PaneId::Terminal(1),
Dimension::percent(33.3),
33,
0,
0,
Some(1),
mock_panes
);
mock_pane!(
PaneId::Terminal(2),
Dimension::percent(33.3),
33,
0,
33,
Some(2),
mock_panes
... |
rust_dataset_chunk_513658 | rust_dataset.txt | 513,658 | 512 | (&self) -> usize {
unimplemented!()
}
fn cols(&self) -> usize {
unimplemented!()
}
fn get_content_x(&self) -> usize {
unimplemented!()
}
fn get_content_y(&self) -> usize {
unimplemented!()
}
fn get_content_columns(&self) -> usize {
unimplemented!()... |
rust_dataset_chunk_513659 | rust_dataset.txt | 513,659 | 512 | FrameParams,
_input_mode: InputMode,
) -> Result<Option<(Vec<CharacterChunk>, Option<String>)>> {
unimplemented!()
}
fn render_fake_cursor(
&mut self,
_cursor_color: PaletteColor,
_text_color: PaletteColor,
) -> Option<crate::output::CharacterChunk> {
uni... |
rust_dataset_chunk_513660 | rust_dataset.txt | 513,660 | 512 | fn set_frame(&mut self, _frame: bool) {
unimplemented!()
}
fn set_content_offset(&mut self, _offset: Offset) {
unimplemented!()
}
fn store_pane_name(&mut self) {
unimplemented!()
}
fn load_pane_name(&mut self) {
unimplemented!()
}
fn set_borderless(&mu... |
rust_dataset_chunk_513661 | rust_dataset.txt | 513,661 | 512 | ::new(mock_panes.clone())
.fill_space_over_pane_in_stack(&PaneId::Terminal(1))
.unwrap();
let remaining_geom = mock_panes
.borrow()
.get(&PaneId::Terminal(2))
.unwrap()
.current_geom();
assert_eq!(remaining_geom.stacked, None);
assert_eq!(remaining_geom.y, 0);... |
rust_dataset_chunk_513662 | rust_dataset.txt | 513,662 | 512 | anes.clone())
.fill_space_over_pane_in_stack(&PaneId::Terminal(1))
.unwrap();
let flexible_geom = mock_panes
.borrow()
.get(&PaneId::Terminal(2))
.unwrap()
.current_geom();
assert_eq!(flexible_geom.stacked, Some(0));
}
--- FILE: zellij/zellij-server/src/panes/un... |
rust_dataset_chunk_513663 | rust_dataset.txt | 513,663 | 512 | 8_len(), "\u{1F468}\u{200D}\u{1F469}".len());
}
#[test]
fn a_cell_keeps_at_most_thirty_two_code_points() {
let mut cell = TerminalCharacter::new('a');
for _ in 1..MAX_CODE_POINTS_PER_CELL {
assert!(cell.attach('\u{0301}'));
}
assert_eq!(cell.code_point_count(), MAX_CODE_POINTS_PER_CELL);
le... |
rust_dataset_chunk_513664 | rust_dataset.txt | 513,664 | 512 | assert_eq!(cluster_table::live_entries(), 1);
target.copy_glyph_from(&inline);
assert_eq!(target.text(), "b\u{0303}");
drop(tagged);
assert_eq!(cluster_table::live_entries(), 0);
let tagged_again = cell_with("d\u{0301}\u{0302}");
target.copy_glyph_from(&tagged_again);
drop(tagged_again);
... |
rust_dataset_chunk_513665 | rust_dataset.txt | 513,665 | 512 | HOLDER.with(|holder| {
holder
.borrow_mut()
.push(cell_with("a\u{0301}\u{0302}\u{0303}"));
holder.borrow_mut().push(cell_with("b\u{0301}"));
});
});
assert!(handle.join().is_ok());
}
--- FILE: zellij/zellij-server/src/panes/unit/grapheme_grid_te... |
rust_dataset_chunk_513666 | rust_dataset.txt | 513,666 | 512 | cols: usize) -> Grid {
Grid::new(
rows,
cols,
Rc::new(RefCell::new(Palette::default())),
Rc::new(RefCell::new(HashMap::new())),
Rc::new(RefCell::new(LinkHandler::new())),
Rc::new(RefCell::new(None)),
Rc::new(RefCell::new(SixelImageStore::default())),
... |
rust_dataset_chunk_513667 | rust_dataset.txt | 513,667 | 512 | cursor(&grid), (columns, 0), "content={:?}", content);
assert_cached_width_is_fresh(&mut grid.viewport[0]);
}
#[test]
fn every_category_in_default_mode() {
check("abc", false, &[("a", 1), ("b", 1), ("c", 1)]);
check(
"\u{4F60}\u{597D}",
false,
&[("\u{4F60}", 2), ("\u{597D}", 2)],
... |
rust_dataset_chunk_513668 | rust_dataset.txt | 513,668 | 512 | 0F}\u{200D}", 1), ("\u{1F308}", 2)],
);
check(ENGLAND, false, &[(ENGLAND, 2)]);
check(KSSA, false, &[("\u{0915}\u{094D}", 1), ("\u{0937}", 1)]);
check(KAA, false, &[("\u{0915}", 1), ("\u{093E}", 1)]);
check(THAI, false, &[("\u{0E01}\u{0E49}", 1), ("\u{0E33}", 1)]);
check(JAMO_LVT, false, &[(JAMO... |
rust_dataset_chunk_513669 | rust_dataset.txt | 513,669 | 512 | u{1F3FD}", 2)]);
check(FLAG_DE, true, &[(FLAG_DE, 2)]);
check(
"\u{1F1E9}\u{1F1EA}\u{1F1EB}",
true,
&[(FLAG_DE, 2), ("\u{1F1EB}", 1)],
);
check(FAMILY, true, &[(FAMILY, 2)]);
check(RAINBOW, true, &[(RAINBOW, 2)]);
check(ENGLAND, true, &[(ENGLAND, 2)]);
check(KSSA, tru... |
rust_dataset_chunk_513670 | rust_dataset.txt | 513,670 | 512 | {1b}[D\u{0301}", false);
assert_eq!(
cells(&grid, 0),
vec![cell("a", 1), cell("b\u{0301}", 1), cell("c", 1)]
);
assert_eq!(cursor(&grid), (2, 0));
}
#[test]
fn a_mark_at_column_zero_is_dropped() {
let grid = grid_with("abc\r\u{0301}", false);
assert_eq!(
cells(&grid, 0),
... |
rust_dataset_chunk_513671 | rust_dataset.txt | 513,671 | 512 | {FE0F}", 2), cell(" ", 1)]
);
assert_cached_width_is_fresh(&mut grid.viewport[0]);
}
#[test]
fn grapheme_mode_widening_at_the_right_edge_wraps_the_cell() {
let mut grid = new_grid(5, 5);
feed(&mut grid, "\u{1b}[?2027habcd\u{26A0}\u{FE0F}");
assert_eq!(
cells(&grid, 0),
vec![
... |
rust_dataset_chunk_513672 | rust_dataset.txt | 513,672 | 512 | (&mut grid.viewport[0]);
let grid = grid_with("\u{1F600}\u{FE0E}", true);
assert_eq!(cells(&grid, 0), vec![cell("\u{1F600}\u{FE0E}", 2)]);
}
#[test]
fn grapheme_mode_can_be_queried_and_switched() {
let mut grid = new_grid(5, 20);
feed(&mut grid, "\u{1b}[?2027$p");
feed(&mut grid, "\u{1b}[?2027h\u{1... |
rust_dataset_chunk_513673 | rust_dataset.txt | 513,673 | 512 | $p");
let replies: Vec<String> = grid
.pending_messages_to_pty
.iter()
.map(|m| String::from_utf8_lossy(m).to_string())
.collect();
assert_eq!(replies, vec!["\u{1b}[?2027;1$y".to_string()]);
}
#[test]
fn turning_the_mode_off_or_resetting_returns_to_clusters_by_default() {
le... |
rust_dataset_chunk_513674 | rust_dataset.txt | 513,674 | 512 | !(cells(&grid, 0), vec![cell(THUMBS_TONE, 2); 2]);
assert_eq!(cursor(&grid), (4, 0));
}
#[test]
fn rep_after_a_lone_mark_repeats_nothing_visible() {
let grid = grid_with("\u{0301}\u{1b}[3b", false);
assert!(grid.viewport[0].columns.iter().all(|c| c.is_plain_blank()));
assert_eq!(cursor(&grid), (0, 0));... |
rust_dataset_chunk_513675 | rust_dataset.txt | 513,675 | 512 | cluster_table::live_entries(), 0);
let grid = grid_with("a\u{0301}b\u{1b}[1G\u{1b}[@", false);
assert_eq!(
cells(&grid, 0)[..3].to_vec(),
vec![cell(" ", 1), cell("a\u{0301}", 1), cell("b", 1)]
);
let grid = grid_with(&format!("x{}y\u{1b}[3G\u{1b}[K", FAMILY), false);
assert_eq!(cells... |
rust_dataset_chunk_513676 | rust_dataset.txt | 513,676 | 512 | assert!(grid.viewport.iter().take(3).all(|row| row.may_have_groups));
let total: usize = grid.viewport.iter().map(|row| row.columns.len()).sum();
assert_eq!(total, 11);
}
#[test]
fn rewrap_keeps_cells_whole_and_a_widened_cell_wraps_whole() {
let mut grid = new_grid(5, 10);
feed(&mut grid, "\u{1b}[?... |
rust_dataset_chunk_513677 | rust_dataset.txt | 513,677 | 512 | (scroll_buffer_size + grid.height + 1) {
grid.add_canonical_line();
}
assert_eq!(cluster_table::live_entries(), 0);
drop(grid);
assert_eq!(cluster_table::bytes(), 0);
}
#[test]
fn dropping_a_grid_full_of_clusters_empties_the_table() {
let mut grid = new_grid(10, 20);
let mut content = S... |
rust_dataset_chunk_513678 | rust_dataset.txt | 513,678 | 512 | b}[3G\u{1b}[@", false);
let text: String = cells(&grid, 0).into_iter().map(|(t, _)| t).collect();
assert!(text.starts_with("a \u{17D8}b"), "text={:?}", text);
assert_eq!(grid.viewport[0].absolute_character_index(4), 2);
}
#[test]
fn copying_keeps_every_category_whole() {
let samples = [
"e\u{03... |
rust_dataset_chunk_513679 | rust_dataset.txt | 513,679 | 512 | !(copied, format!("x{}", FAMILY));
}
#[test]
fn dump_screen_and_pane_contents_hold_full_clusters() {
let mut grid = new_grid(5, 20);
feed(
&mut grid,
&format!("a{}e\u{0301}\r\n\u{1b}[31m{}\u{1b}[0m", FAMILY, KSSA),
);
let dump = grid.dump_screen(true);
assert!(
dump.contains... |
rust_dataset_chunk_513680 | rust_dataset.txt | 513,680 | 512 | ;
while added < 10_000 {
let value = plane * 0x10000 + (rng.next() % 0x10000) as u32;
if let Some(c) = char::from_u32(value) {
sample.push(c);
added += 1;
}
}
}
sample.sort_unstable();
sample.dedup();
let partners: Vec<c... |
rust_dataset_chunk_513681 | rust_dataset.txt | 513,681 | 512 | {200D}', 'b'));
assert!(grapheme_join::may_join('\u{1F44D}', '\u{1F3FD}'));
assert!(grapheme_join::may_join('\u{0915}', '\u{093E}'));
}
fn fixture(name: &str) -> String {
let path = std::path::PathBuf::from("../src/tests/fixtures").join(name);
String::from_utf8(std::fs::read(&path).unwrap()).unwrap()
}... |
rust_dataset_chunk_513682 | rust_dataset.txt | 513,682 | 512 | ()
.position(|row| !row.columns.is_empty())
.unwrap();
let trimmed = |row: Vec<(String, usize)>| -> Vec<(String, usize)> {
let mut row = row;
while row.last().map(|(t, _)| t == " ").unwrap_or(false) {
row.pop();
}
row
};
assert_eq!(trimmed(cells(&r... |
rust_dataset_chunk_513683 | rust_dataset.txt | 513,683 | 512 | X} after U+{:04X}",
value,
left as u32
);
}
for right in right_partners {
assert!(
has_boundary(c, right),
"U+{:04X} before U+{:04X}",
value,
ri... |
rust_dataset_chunk_513684 | rust_dataset.txt | 513,684 | 512 | .or_insert_with(StructuredClientState::default);
state.enabled = true;
state.reset_viewport(Size {
rows: ROWS,
cols: COLS,
});
}
Output::new(
Rc::new(RefCell::new(SixelImageStore::default())),
Rc::new(RefCell::new(Some(SizeInPixels {
... |
rust_dataset_chunk_513685 | rust_dataset.txt | 513,685 | 512 | 32).unwrap());
}
out.push_str("\r\n");
}
out
}
fn emoji_block(rng: &mut Rng) -> String {
let samples = [
"\u{1F468}\u{200D}\u{1F469}\u{200D}\u{1F467}",
"\u{1F44D}\u{1F3FD}",
"\u{1F1E9}\u{1F1EA}",
"\u{1F3F3}\u{FE0F}\u{200D}\u{1F308}",
"\u{26A0}\u{FE0F}... |
rust_dataset_chunk_513686 | rust_dataset.txt | 513,686 | 512 | u32).unwrap());
}
}
out.push_str("\r\n");
}
out
}
fn feed(grid: &mut Grid, block: &str) -> (Duration, usize) {
let mut parser = crate::vt_parser::Parser::new();
let bytes = block.as_bytes();
let target_bytes = std::env::var("GRAPHEME_PERF_MB")
.ok()
.and... |
rust_dataset_chunk_513687 | rust_dataset.txt | 513,687 | 512 | | case != name).unwrap_or(false) {
continue;
}
let mut rng = Rng(0x9E3779B97F4A7C15);
let block = make(&mut rng);
let mut grid = new_grid();
let (feed_time, peak_table_bytes) = feed(&mut grid, &block);
let ansi_time = serialize_screen(&mut grid, false);
... |
rust_dataset_chunk_513688 | rust_dataset.txt | 513,688 | 512 | 110,
Rc::new(RefCell::new(Palette::default())),
Rc::new(RefCell::new(HashMap::new())),
Rc::new(RefCell::new(LinkHandler::new())),
Rc::new(RefCell::new(None)),
Rc::new(RefCell::new(SixelImageStore::default())),
Rc::new(RefCell::new(KittyImageStore::default())),
Sty... |
rust_dataset_chunk_513689 | rust_dataset.txt | 513,689 | 512 | text == cluster).count()
}
fn cell_of<'a>(grid: &'a Grid, row: usize, cluster: &str) -> &'a TerminalCharacter {
grid.viewport[row]
.columns
.iter()
.find(|cell| {
let mut text = String::new();
cell.push_text_to(&mut text);
text == cluster
})
... |
rust_dataset_chunk_513690 | rust_dataset.txt | 513,690 | 512 | let grid = render("text", &format!("1${}", encoded(&content)));
assert_whole_clusters(&row_cells(&grid, 0));
assert_eq!(cell_of(&grid, 0, FAMILY).styles.foreground, emphasis);
assert_eq!(cell_of(&grid, 0, "a").styles.foreground, base);
assert_eq!(cell_of(&grid, 0, "b").styles.foreground, base);
let... |
rust_dataset_chunk_513691 | rust_dataset.txt | 513,691 | 512 | !(row_width(&cells), 9);
}
#[test]
fn nested_list_component_pads_lines_by_cluster_width() {
let first = format!("{} family", FAMILY);
let second = format!("{}t\u{e9} {}", DECOMPOSED_E, FLAG);
let grid = render(
"nested_list",
&format!("{};|{}", encoded(&first), encoded(&second)),
);
... |
rust_dataset_chunk_513692 | rust_dataset.txt | 513,692 | 512 | , 0, FAMILY).styles.reverse, Some(AnsiCode::On));
assert_ne!(cell_of(&grid, 0, "a").styles.reverse, Some(AnsiCode::On));
assert_ne!(cell_of(&grid, 0, "b").styles.reverse, Some(AnsiCode::On));
}
#[test]
fn text_input_component_stops_before_a_cluster_that_does_not_fit() {
let grid = render(
"text_inp... |
rust_dataset_chunk_513693 | rust_dataset.txt | 513,693 | 512 | "https://zellij.dev/documentation/inbox-integrations.html";
fn link_at_cell(grid: &Grid, row: usize, index: usize) -> Option<String> {
let link_handler = grid.link_handler.borrow();
grid.viewport
.get(row)
.and_then(|row| row.columns.get(index))
.and_then(|cell| link_handler.uri(cell.s... |
rust_dataset_chunk_513694 | rust_dataset.txt | 513,694 | 512 | s_with("our integrationsx"), "{:?}", text);
for index in 0..label.len() {
assert_eq!(
link_at_cell(&grid, 0, index).as_deref(),
Some(LINK_URL),
"cell {}",
index
);
}
assert_eq!(link_at_cell(&grid, 0, label.le... |
rust_dataset_chunk_513695 | rust_dataset.txt | 513,695 | 512 | );
}
}
fn row_from_str(content: &str) -> crate::panes::grid::Row {
use crate::panes::terminal_character::TerminalCharacter;
crate::panes::grid::Row::from_columns(
content
.chars()
.map(|character| TerminalCharacter::new_styled(character, Default::default()))
... |
rust_dataset_chunk_513696 | rust_dataset.txt | 513,696 | 512 | {
use crate::panes::terminal_character::EMPTY_TERMINAL_CHARACTER;
for (content, to, expected) in [
("ab你c好", 2, " c好"),
("ab你c好", 3, " c好"),
("ab你c好", 4, " 好"),
("你好你好", 3, " 你好"),
("ab", 0, " b"),
] {
let mut row = row_from_str(content);
... |
rust_dataset_chunk_513697 | rust_dataset.txt | 513,697 | 512 | _name = "vttest1-0";
let content = read_fixture(fixture_name);
vte_parser.feed(&mut grid, &content);
assert_snapshot!(format!("{:?}", grid));
}
#[test]
fn vttest1_1() {
let mut vte_parser = vt_parser::Parser::new();
let sixel_image_store = Rc::new(RefCell::new(SixelImageStore::default()));
let ... |
rust_dataset_chunk_513698 | rust_dataset.txt | 513,698 | 512 | debug,
arrow_fonts,
styled_underlines,
osc8_hyperlinks,
explicitly_disable_kitty_keyboard_protocol,
);
let fixture_name = "vttest1-2";
let content = read_fixture(fixture_name);
vte_parser.feed(&mut grid, &content);
assert_snapshot!(format!("{:?}", grid));
}
#[test]
... |
rust_dataset_chunk_513699 | rust_dataset.txt | 513,699 | 512 | (None)),
sixel_image_store,
Rc::new(RefCell::new(KittyImageStore::default())),
Style::default(),
debug,
arrow_fonts,
styled_underlines,
osc8_hyperlinks,
explicitly_disable_kitty_keyboard_protocol,
);
let fixture_name = "vttest1-4";
let content ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.