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_513500 | rust_dataset.txt | 513,500 | 512 | Pane to split {:?} not found", active_pane_id);
return Some(new_pane);
};
if full_pane_size.is_stacked() {
match StackedPanes::new_from_btreemap(&mut self.panes, &self.panes_to_hide)
.position_and_size_of_stack(&active_pane_id)
{
Some(p... |
rust_dataset_chunk_513501 | rust_dataset.txt | 513,501 | 512 | self.set_force_render();
self.reapply_pane_frames();
}
pub fn pane_ids_in_stack_of_pane_id(&mut self, pane_id: &PaneId) -> Vec<PaneId> {
if let Some(stack_id) = self
.panes
.get(pane_id)
.and_then(|p| p.position_and_size().stacked)
{
... |
rust_dataset_chunk_513502 | rust_dataset.txt | 513,502 | 512 | _geom().stacked)
{
stack_ids_to_pane_ids_to_expand.push((stack_id, *pane_id));
}
self.active_panes
.insert(client_id, *pane_id, &mut self.panes);
self.set_pane_active_at(*pane_id);
... |
rust_dataset_chunk_513503 | rust_dataset.txt | 513,503 | 512 | self.set_force_render();
self.reapply_pane_frames();
all_panes_in_stack
},
Err(e) => {
log::error!("Failed to expand pane in stack: {:?}", e);
vec![]
},
}
}
pub fn focus_pane(&mut self, pa... |
rust_dataset_chunk_513504 | rust_dataset.txt | 513,504 | 512 | pane_id: PaneId, client_id: ClientId) -> Result<()> {
if self.panes.get(&pane_id).is_some() {
self.focus_pane(pane_id, client_id);
Ok(())
} else {
Err(anyhow!("Pane not found"))
}
}
pub fn focus_pane_at_position(&mut self, position_and_size: PaneGeom,... |
rust_dataset_chunk_513505 | rust_dataset.txt | 513,505 | 512 | borrowed_box)]
pub fn get_pane(&self, pane_id: PaneId) -> Option<&Box<dyn Pane>> {
self.panes.get(&pane_id)
}
pub fn get_pane_mut(&mut self, pane_id: PaneId) -> Option<&mut Box<dyn Pane>> {
self.panes.get_mut(&pane_id)
}
pub fn get_active_pane_id(&self, client_id: ClientId) -> Option... |
rust_dataset_chunk_513506 | rust_dataset.txt | 513,506 | 512 | _boundaries: HashMap<ClientId, Boundaries> = HashMap::new();
let fallback_line_style = self
.style
.border_style
.uniform_style()
.unwrap_or(LineStyle::Single);
let under_floating = if floating_panes_are_visible {
zellij_utils::structured_rende... |
rust_dataset_chunk_513507 | rust_dataset.txt | 513,507 | 512 | <PaneId> = HashSet::new();
for (kind, pane) in self.panes.iter_mut() {
match kind {
PaneId::Terminal(_) => {
output.add_pane_contents(
&connected_clients,
pane.pid(),
pane.pane_contents(None, ... |
rust_dataset_chunk_513508 | rust_dataset.txt | 513,508 | 512 | , under_floating),
crate::output::PaneScroll::of(pane.pid(), pane.viewport_scroll_state()),
);
}
let show_help_text = active_panes.iter().any(|(client_id, pane_id)| {
pane_id == &pane.pid()
&& help_te... |
rust_dataset_chunk_513509 | rust_dataset.txt | 513,509 | 512 | _in_stack {
log_render_error!(
self.panes_with_logged_render_errors,
panes_that_failed_to_render,
*kind,
err_context,
pane_contents_... |
rust_dataset_chunk_513510 | rust_dataset.txt | 513,510 | 512 | (modal_clients, plain_clients): (Vec<ClientId>, Vec<ClientId>) =
connected_clients.iter().copied().partition(|client_id| {
pane_contents_and_ui.client_has_guest_modal(*client_id)
});
if !plai... |
rust_dataset_chunk_513511 | rust_dataset.txt | 513,511 | 512 | when they are toggled off, we will make sure to re-render the title
self.window_title = None;
}
Ok(())
}
pub fn get_panes(&self) -> impl Iterator<Item = (&PaneId, &Box<dyn Pane>)> {
self.panes.iter()
}
pub fn position_and_size_of_stack(&mut self, pane_id: &PaneId) ->... |
rust_dataset_chunk_513512 | rust_dataset.txt | 513,512 | 512 | = self.display_area.borrow().clone();
self.resize(display_area);
}
pub fn resize(&mut self, new_screen_size: Size) {
{
if self.display_area_changed(new_screen_size) {
self.clear_tombstones();
}
let mut display_area = self.display_area.borrow_... |
rust_dataset_chunk_513513 | rust_dataset.txt | 513,513 | 512 | display_area, &mut viewport, rows);
if successfully_resized_vertically {
resize_horizontally(&mut pane_grid, &mut display_area, &mut viewport, cols);
} else {
log::error!("Failed to resize vertically, will not attempt again.");
}
... |
rust_dataset_chunk_513514 | rust_dataset.txt | 513,514 | 512 | _percent: (f64, f64)) -> bool {
// true - successfully resized
let mut strategy = ResizeStrategy::new(Resize::Increase, Some(Direction::Down));
strategy.invert_on_boundaries = false;
let successfully_resized_up =
match self.resize_pane_with_id(strategy, pane_id, Some(resize_p... |
rust_dataset_chunk_513515 | rust_dataset.txt | 513,515 | 512 | _percent: (f64, f64)) -> bool {
// true - successfully resized
let mut strategy = ResizeStrategy::new(Resize::Increase, Some(Direction::Right));
strategy.invert_on_boundaries = false;
let successfully_resized_up =
match self.resize_pane_with_id(strategy, pane_id, Some(resize_... |
rust_dataset_chunk_513516 | rust_dataset.txt | 513,516 | 512 | crease(
&mut self,
focused_pane_id: PaneId,
pane_state: HashMap<PaneId, PaneGeom>,
) {
match self.tombstones_before_decrease.as_mut() {
Some((focused_pane_id_in_tombstone, pane_geoms)) => {
let last_state = pane_geoms.last();
let last_state... |
rust_dataset_chunk_513517 | rust_dataset.txt | 513,517 | 512 | return Ok(true);
} else {
self.tombstones_before_decrease = None;
}
}
},
_ => {},
}
let mut current_pan... |
rust_dataset_chunk_513518 | rust_dataset.txt | 513,518 | 512 | {
self.update_tombstones_before_increase(pane_id, current_pane_state);
} else {
if self.fullscreen_is_active.is_none() {
self.toggle_pane_fullscreen(pane_id);
return Ok(self.f... |
rust_dataset_chunk_513519 | rust_dataset.txt | 513,519 | 512 | {
Ok(pane_size_changed) => {
if pane_size_changed {
self.update_tombstones_before_decrease(pane_id, current_pane_state);
self.reapply_pane_frames();
Ok(pane_size_changed)
... |
rust_dataset_chunk_513520 | rust_dataset.txt | 513,520 | 512 | },
_ => {
return Err(err);
},
},
}
for pane in self.panes.values_mut() {
// TODO: only for the panes whose width/height actually changed
resize_pty!(pane, self.os_api, self.senders, self.character_cell_size).non_fa... |
rust_dataset_chunk_513521 | rust_dataset.txt | 513,521 | 512 | (|p| p.current_geom().is_stacked())
.unwrap_or(false)
{
let _ = StackedPanes::new_from_btreemap(&mut self.panes, &self.panes_to_hide)
.expand_pane(&next_active_pane_id);
self.reapply_pane_frames();
}
if active_pane_id != next_active_pane_id {
... |
rust_dataset_chunk_513522 | rust_dataset.txt | 513,522 | 512 | .get(&client_id).copied() else {
return;
};
if !self.panes.contains_key(&last_pane_id) || last_pane_id == previously_active_pane_id {
self.focus_previous_pane(client_id);
return;
}
if let Some(previously_active_pane) = self.panes.get_mut(&previously_a... |
rust_dataset_chunk_513523 | rust_dataset.txt | 513,523 | 512 |
.active_panes
.get(&client_id)
.copied()
.and_then(|active_pane_id| self.panes.get_mut(&active_pane_id))
{
previously_active_pane.set_should_render(true);
previously_active_pane.render_full_viewport();
}
if let Some(next_ac... |
rust_dataset_chunk_513524 | rust_dataset.txt | 513,524 | 512 | pane_grid = TiledPaneGrid::new(
&mut self.panes,
&self.panes_to_hide,
*self.display_area.borrow(),
*self.viewport.borrow(),
);
let next_index = pane_grid.next_selectable_pane_id_to_the_left(&active_pane_id);... |
rust_dataset_chunk_513525 | rust_dataset.txt | 513,525 | 512 | the pty know about this (like in a
// normal size change)
self.focus_pane_for_all_clients_in_stack(p, stack_id);
self.reapply_pane_frames();
}
true
},
... |
rust_dataset_chunk_513526 | rust_dataset.txt | 513,526 | 512 | _area.borrow(),
*self.viewport.borrow(),
);
let next_index = pane_grid.next_selectable_pane_id_to_the_right(&active_pane_id);
match next_index {
Some(p) => {
if let Some(previously_active_pane) = self.panes.g... |
rust_dataset_chunk_513527 | rust_dataset.txt | 513,527 | 512 | _position.set_should_render(true);
}
self.focus_pane_for_all_clients(active_pane_id);
self.set_pane_frames(self.pane_frame_style);
}
}
pub fn move_active_pane(&mut self, search_backwards: bool, client_id: ClientId) {
if let Some(active_pane_id) = self.get_acti... |
rust_dataset_chunk_513528 | rust_dataset.txt | 513,528 | 512 | ;
};
if let Some(new_position) = self.panes.get_mut(&other_pane_id) {
new_position.set_geom(prev_geom);
if let Some(geom) = prev_geom_override {
new_position.set_geom_override(geom);
}
resize_pty!(
new_position,
... |
rust_dataset_chunk_513529 | rust_dataset.txt | 513,529 | 512 | _selectable_pane_id_to_the_left(&pane_id);
if let Some(p) = next_index {
self.swap_pane_positions(pane_id, p);
}
}
pub fn move_active_pane_right(&mut self, client_id: ClientId) {
if let Some(active_pane_id) = self.get_active_pane_id(client_id) {
self.move_pane_rig... |
rust_dataset_chunk_513530 | rust_dataset.txt | 513,530 | 512 | , &Box<dyn Pane>)> = self
.panes
.iter()
.filter(|(p_id, p)| !self.panes_to_hide.contains(p_id) && p.selectable())
.collect();
next_active_pane_candidates.sort_by(|(_pane_id_a, pane_a), (_pane_id_b, pane_b)| {
pane_a.active_at().cmp(&pane_b.active_at()... |
rust_dataset_chunk_513531 | rust_dataset.txt | 513,531 | 512 | ane_constraints_to_neighbors(pane_id);
}
self.panes_to_hide.forget(&pane_id);
let mut pane_grid = TiledPaneGrid::new(
&mut self.panes,
&self.panes_to_hide,
*self.display_area.borrow(),
*self.viewport.borrow(),
);
let closed_pane = i... |
rust_dataset_chunk_513532 | rust_dataset.txt | 513,532 | 512 | _active.is_some()
}
pub fn fullscreen_pane_id(&self) -> Option<PaneId> {
self.fullscreen_is_active
}
pub fn fullscreen_covers_ui(&self) -> bool {
*self.fullscreen_covers_ui.borrow()
}
pub fn unset_fullscreen(&mut self) {
if let Some(fullscreen_pane_id) = self.fullscreen_i... |
rust_dataset_chunk_513533 | rust_dataset.txt | 513,533 | 512 | .unset_fullscreen();
if !was_no_ui {
self.set_fullscreen(pane_id, true);
}
} else {
self.set_fullscreen(pane_id, true);
}
}
fn set_fullscreen(&mut self, pane_id: PaneId, covers_ui: bool) {
let covered = self.panes_covered_by_fullscreen... |
rust_dataset_chunk_513534 | rust_dataset.txt | 513,534 | 512 | );
}
fn expand_pane_over_area(
&mut self,
pane_id: PaneId,
x: usize,
y: usize,
rows: usize,
cols: usize,
) {
if let Some(pane) = self.get_pane_mut(pane_id) {
let mut expanded_geom = PaneGeom {
x,
y,
... |
rust_dataset_chunk_513535 | rust_dataset.txt | 513,535 | 512 | , covers_ui);
return ret;
}
pub fn switch_next_pane_fullscreen(&mut self, client_id: ClientId) {
let covers_ui = *self.fullscreen_covers_ui.borrow();
self.unset_fullscreen();
self.focus_next_pane(client_id);
self.reenter_active_pane_fullscreen(client_id, covers_ui);
... |
rust_dataset_chunk_513536 | rust_dataset.txt | 513,536 | 512 | self.move_clients_out_of_pane(pane_id);
}
true
}
pub fn serialization_geoms_with_collapsed_panes_expanded(&self) -> HashMap<PaneId, PaneGeom> {
let collapsed_spaces: Vec<PaneGeom> = self
.panes_to_hide
.covered()
.filter_map(|pane_id| self.... |
rust_dataset_chunk_513537 | rust_dataset.txt | 513,537 | 512 | geoms.insert(pane_id, geom);
}
}
geoms
}
fn hand_collapsed_pane_constraints_to_neighbors(&mut self, pane_id: PaneId) {
let Some(space) = self
.panes
.get(&pane_id)
.map(|pane| pane.position_and_size())
else {
... |
rust_dataset_chunk_513538 | rust_dataset.txt | 513,538 | 512 | anes.get_mut(&neighbor_id) {
let mut geom = neighbor.position_and_size();
if let Some(percent) = geom.cols.as_percent() {
geom.cols.set_percent(percent + share);
neighbor.set_geom(geom);
}
}
}
}
pub fn pa... |
rust_dataset_chunk_513539 | rust_dataset.txt | 513,539 | 512 | {
return false;
}
if !hidden {
let holds_no_space_of_its_own = self.panes_to_hide.is_hidden_bar(&pane_id)
&& !self.panes_to_hide.is_collapsed(&pane_id);
if holds_no_space_of_its_own {
self.give_space_back_to(pane_id);
}
... |
rust_dataset_chunk_513540 | rust_dataset.txt | 513,540 | 512 | => self.panes.split_off(&first_pid),
None => BTreeMap::new(),
}
}
pub fn active_panes(&self) -> ActivePanes {
self.active_panes.clone()
}
pub fn set_active_panes(&mut self, active_panes: ActivePanes) {
self.active_panes = active_panes;
}
pub fn move_client_fo... |
rust_dataset_chunk_513541 | rust_dataset.txt | 513,541 | 512 | ane_group);
let is_focused = self.active_panes.pane_id_is_focused(pane_id);
pane_info_for_pane.is_floating = false;
pane_info_for_pane.is_suppressed = false;
pane_info_for_pane.is_collapsed = self.panes_to_hide.is_covered(pane_id);
pane_info_for_pane.is_focuse... |
rust_dataset_chunk_513542 | rust_dataset.txt | 513,542 | 512 | new_from_btreemap(&mut self.panes, &self.panes_to_hide)
.new_stack(root_pane_id, pane_count_in_stack)
}
fn is_connected(&self, client_id: &ClientId) -> bool {
self.connected_clients.borrow().contains(&client_id)
}
pub fn stacked_pane_ids_under_and_over_flexible_panes(
&mut se... |
rust_dataset_chunk_513543 | rust_dataset.txt | 513,543 | 512 | able_pane_id_to_the_right(&pane_id)
}
}
#[allow(clippy::borrowed_box)]
pub fn is_inside_viewport(viewport: &Viewport, pane: &Box<dyn Pane>) -> bool {
let pane_position_and_size = pane.current_geom();
pane_position_and_size.y >= viewport.y
&& pane_position_and_size.y + pane_position_and_size.rows.as... |
rust_dataset_chunk_513544 | rust_dataset.txt | 513,544 | 512 | _start.min(end))
} else {
(space_end.max(start), end)
};
if new_end > new_start {
Some((new_start, new_end))
} else {
None
}
}
fn bounding_geom_of_stack(members: &[(PaneId, PaneGeom)]) -> Option<PaneGeom> {
let (_, first) = members.first()?;
let (_, last) = members.l... |
rust_dataset_chunk_513545 | rust_dataset.txt | 513,545 | 512 | FIXME: Just hold a mutable Pane reference instead of the PaneId, fixed, pos, and size?
// Do this after panes are no longer trait-objects!
#[derive(Debug, Clone, Copy)]
struct Span {
pid: PaneId,
direction: SplitDirection,
pos: usize,
size: Dimension,
size_var: Variable,
}
type Grid = Vec<Vec<Span... |
rust_dataset_chunk_513546 | rust_dataset.txt | 513,546 | 512 | 64 pane sizes to usize without gaps or overlap
let mut finalised = Vec::new();
for spans in &mut grid {
let rounded_size: isize = spans.iter().map(|s| rounded_sizes[&s.size_var]).sum();
let mut error = space as isize - rounded_size;
let mut flex_spans: Vec<_> = spans
... |
rust_dataset_chunk_513547 | rust_dataset.txt | 513,547 | 512 | if span.size.as_usize() < min_stack_height {
return false;
}
}
}
true
}
fn apply_spans(&mut self, spans: Vec<Span>) -> Result<()> {
let err_context = || format!("Failed to apply spans");
let mut geoms_changed = false;
for ... |
rust_dataset_chunk_513548 | rust_dataset.txt | 513,548 | 512 | {
// probably a rounding issue - this might be considered an error depending on who
// called us - if it's an explicit resize operation, it's clearly an error (the user
// wanted to resize and doesn't care about percentage rounding), if it's resizing the
// terminal wind... |
rust_dataset_chunk_513549 | rust_dataset.txt | 513,549 | 512 | position_and_size = {
let pas = pane.current_geom();
if pas.is_stacked() && pas.rows.is_percent() {
// this is the main pane of the stack
StackedPanes::new(self.panes.clone()).position_and_size_of_stack(&pane.pid())
} else if pas.is_stacked() {
... |
rust_dataset_chunk_513550 | rust_dataset.txt | 513,550 | 512 | _var | EQ(Strength::REQUIRED) | s as f64)
},
Constraint::Percent(p) => constraints.insert(
(span.size_var / new_flex_space as f64) | EQ(Strength::STRONG) | (p / 100.0),
),
};
}
Ok(constraints)
}
fn stable_round(x: f64) -> f64 {
((x * 100.0).round... |
rust_dataset_chunk_513551 | rust_dataset.txt | 513,551 | 512 | _fullscreen.contains(pane_id)
&& self.fullscreen_pane != Some(**pane_id)
})
.count();
self.beneath_fullscreen.len() + covered_and_not_beneath_fullscreen
}
/// The fullscreen pane itself is never hidden, even if it is also covered.
pub fn set_fullscreen(&mu... |
rust_dataset_chunk_513552 | rust_dataset.txt | 513,552 | 512 | _id)
}
pub fn covered(&self) -> impl Iterator<Item = &PaneId> {
self.covered.iter().chain(
self.hidden_bars
.iter()
.filter(|pane_id| !self.covered.contains(pane_id)),
)
}
/// Uncover every covered pane and return them, to be covered again with... |
rust_dataset_chunk_513553 | rust_dataset.txt | 513,553 | 512 | PaneId::Terminal(2)]));
assert!(!panes_to_hide.contains(&PaneId::Terminal(1)));
assert_eq!(panes_to_hide.len(), 1);
panes_to_hide.unset_fullscreen();
assert!(panes_to_hide.contains(&PaneId::Terminal(1)));
}
#[test]
fn forgotten_pane_is_no_longer_hidden() {
let mut pa... |
rust_dataset_chunk_513554 | rust_dataset.txt | 513,554 | 512 | _and_restoring_covered_panes_keeps_them_apart() {
let mut panes_to_hide = PanesToHide::default();
panes_to_hide.set_covered(PaneId::Plugin(1));
panes_to_hide.set_hidden_bar(PaneId::Plugin(2));
let taken = panes_to_hide.take_covered();
assert_eq!(panes_to_hide.len(), 0);
p... |
rust_dataset_chunk_513555 | rust_dataset.txt | 513,555 | 512 | Result<()> {
let err_context = || format!("Failed to move stacked pane focus down");
let source_pane_stack_id = self
.panes
.borrow()
.get(source_pane_id)
.with_context(err_context)?
.position_and_size()
.stacked;
let desti... |
rust_dataset_chunk_513556 | rust_dataset.txt | 513,556 | 512 | ane = panes.get_mut(source_pane_id).with_context(err_context)?;
let mut source_pane_geom = source_pane.position_and_size();
let mut destination_pane_geom = source_pane_geom.clone();
source_pane_geom.y = (source_pane_geom.y + source_pane_geom.rows.as_usize()) - 1; // -1 because we wan... |
rust_dataset_chunk_513557 | rust_dataset.txt | 513,557 | 512 | (err_context)?;
let (_, mut pane_to_focus) = *all_stacked_pane_positions
.iter()
.nth(position_of_pane_to_focus)
.with_context(err_context)?;
pane_to_focus.rows = height_of_flexible_pane;
panes
.get_mut(pane_id)
... |
rust_dataset_chunk_513558 | rust_dataset.txt | 513,558 | 512 | _in_stack(id).ok()?;
let (_, first_pane_in_stack) = all_stacked_pane_positions.first()?;
let (_, last_pane_in_stack) = all_stacked_pane_positions.last()?;
let mut rows = match self.position_of_flexible_pane(&all_stacked_pane_positions) {
Ok(position_of_flexible_pane) => {
... |
rust_dataset_chunk_513559 | rust_dataset.txt | 513,559 | 512 | )?;
let position_of_flexible_pane = self
.position_of_flexible_pane(&all_stacked_pane_positions)
.with_context(err_context)?;
let (flexible_pane_id, _flexible_pane) = all_stacked_pane_positions
.iter()
.nth(position_of_flexible_pane)
.with_cont... |
rust_dataset_chunk_513560 | rust_dataset.txt | 513,560 | 512 | let adjust_stack_geoms = |new_flexible_pane_geom: PaneGeom| -> Result<()> {
let new_flexible_pane_geom_rows = new_flexible_pane_geom.rows.as_usize();
for (i, (pane_id, pane_geom)) in all_stacked_pane_positions.iter().enumerate() {
let mut new_pane_geom = if i == position_... |
rust_dataset_chunk_513561 | rust_dataset.txt | 513,561 | 512 | _context(err_context)?;
let stack_id = pane_in_stack.position_and_size().stacked;
let mut all_stacked_pane_positions: Vec<(PaneId, PaneGeom)> = panes
.iter()
.filter(|(_pid, p)| {
p.position_and_size().is_stacked() && p.position_and_size().stacked == stack_id
... |
rust_dataset_chunk_513562 | rust_dataset.txt | 513,562 | 512 | let err_context = || format!("Failed to find position of flexible pane");
all_stacked_pane_positions
.iter()
.position(|(_pid, p)| p.rows.is_percent())
.with_context(err_context)
}
pub fn fill_space_over_pane_in_stack(&mut self, id: &PaneId) -> Result<bool> {
... |
rust_dataset_chunk_513563 | rust_dataset.txt | 513,563 | 512 | _ids_on_bottom_of_stacks = HashSet::new();
let all_stacks = self.get_all_stacks()?;
for stack in all_stacks {
if let Some((first_pane_id, _pane)) = stack.iter().next() {
stacked_pane_ids_on_top_of_stacks.insert(*first_pane_id);
}
if let Some((last_pane... |
rust_dataset_chunk_513564 | rust_dataset.txt | 513,564 | 512 | make_room_for_new_pane_in_stack(&mut self, pane_id: &PaneId) -> Result<PaneGeom> {
let err_context = || format!("Failed to add pane to stack");
let stack = self.positions_in_stack(pane_id).with_context(err_context)?;
if let Some((id_of_flexible_pane_in_stack, _flexible_pane_in_stack)) = stack
... |
rust_dataset_chunk_513565 | rust_dataset.txt | 513,565 | 512 | _id: PaneId, pane_count_in_stack: usize) -> Vec<PaneGeom> {
let mut stacked_geoms = vec![];
let panes = self.panes.borrow();
let running_stack_geom = panes.get(&root_pane_id).map(|p| p.position_and_size());
let Some(mut running_stack_geom) = running_stack_geom else {
log::err... |
rust_dataset_chunk_513566 | rust_dataset.txt | 513,566 | 512 | _main_pane, extra_stacked_geoms_of_main_pane))
}
fn positions_of_panes_and_their_stacks(
&self,
pane_ids: Vec<PaneId>,
) -> Option<Vec<(PaneId, PaneGeom)>> {
let mut positions = vec![];
let panes = self.panes.borrow();
for pane_id in &pane_ids {
let geom_o... |
rust_dataset_chunk_513567 | rust_dataset.txt | 513,567 | 512 | copied().collect();
geoms_to_combine.sort_by(|a_geom, b_geom| a_geom.y.cmp(&b_geom.y));
let geom_to_combine = geoms_to_combine.get(0)?;
geom_to_combine
.combine_vertically_with_many(&geoms_to_combine.iter().copied().skip(1).collect())
}
pub fn combine_vertically_aligned_pane... |
rust_dataset_chunk_513568 | rust_dataset.txt | 513,568 | 512 | ane.stacked = Some(stack_id);
let mut all_stack_geoms = other_pane_ids_and_geoms;
let original_geom_of_main_pane = panes
.get(&root_pane_id)
.ok_or_else(|| anyhow!("Failed to find root geom"))?
.position_and_size(); // for sorting purposes
all_stack_geoms.push... |
rust_dataset_chunk_513569 | rust_dataset.txt | 513,569 | 512 | {
// nothing to do
return Ok(());
};
let Some(geom_to_combine) = self.combine_geoms_vertically(&other_pane_ids_and_geoms) else {
log::error!("Failed to combine geoms vertically");
return Ok(());
};
let new_stack_geom = if geom_to_combine.x... |
rust_dataset_chunk_513570 | rust_dataset.txt | 513,570 | 512 | ;
pane_geom.stacked = Some(stack_id);
pane_geom.logical_position = root_pane.position_and_size().logical_position;
root_pane.set_geom(pane_geom);
running_y += pane_geom.rows.as_usize();
}
} else {
... |
rust_dataset_chunk_513571 | rust_dataset.txt | 513,571 | 512 | (&all_stacked_pane_positions)?;
self.set_geom_of_broken_out_pane(
pane_id_to_break_out,
position_and_size_of_broken_out_pane,
);
pane_ids_that_were_resized.push(pane_id_to_break_out);
new_position_and_size_of_stack.stacked = Some(stack_id);
self.reset_stac... |
rust_dataset_chunk_513572 | rust_dataset.txt | 513,572 | 512 | new_position_and_size_of_stack.clone();
let only_one_pane_left_in_stack = all_stacked_pane_positions.len() == 1;
let count_of_one_liners_in_stack =
all_stacked_pane_positions.iter().len().saturating_sub(1);
let flexible_pane_row_count = running_pane_geom
.rows
... |
rust_dataset_chunk_513573 | rust_dataset.txt | 513,573 | 512 | );
running_pane_geom.y += flexible_pane_geom.rows.as_usize();
running_pane_geom
.rows
.decrease_inner(flexible_pane_geom.rows.as_usize());
flexible_pane_geom.logical_position = logical_position;
pane_in_stack.set_geom(flexible_pane_geom);
... |
rust_dataset_chunk_513574 | rust_dataset.txt | 513,574 | 512 | _pane_positions: &mut Vec<(PaneId, PaneGeom)>,
) -> Option<(PaneGeom, PaneGeom, PaneId)> {
let mut new_position_and_size_of_stack = position_and_size_of_stack.clone();
let rows_for_broken_out_pane = new_position_and_size_of_stack
.rows
.split_out(all_stacked_pane_positions.le... |
rust_dataset_chunk_513575 | rust_dataset.txt | 513,575 | 512 | lexible_panes_in_stack {
stacks.push(
self.positions_in_stack(&pane_id)
.with_context(err_context)?,
);
}
Ok(stacks)
}
fn fill_space_over_one_liner_pane(&mut self, id: &PaneId) -> Result<bool> {
let (position_of_current_pane, po... |
rust_dataset_chunk_513576 | rust_dataset.txt | 513,576 | 512 | _to_close.position_and_size();
pane_to_close_position_and_size
.rows
.set_inner(pane_to_close_position_and_size.rows.as_usize() + 1);
pane_to_close_position_and_size.y -= 1;
let pane_id_above = all_stacked_pane_positions
.iter()
... |
rust_dataset_chunk_513577 | rust_dataset.txt | 513,577 | 512 | _size);
for (i, (pid, _position)) in all_stacked_pane_positions.iter().enumerate() {
if i > position_of_flexible_pane && i < position_of_current_pane {
let pane = panes.get_mut(pid).with_context(err_context)?;
let mut pane_position_and_size = pane.position_and_size();... |
rust_dataset_chunk_513578 | rust_dataset.txt | 513,578 | 512 | pane.set_geom(pane_position_and_size);
}
}
Ok(true)
}
fn make_lowest_pane_in_stack_flexible(&mut self, destination_pane_id: &PaneId) -> Result<()> {
let err_context = || format!("Failed to make_lowest_pane_flexible");
let mut all_stacked_pane_positions = self.positio... |
rust_dataset_chunk_513579 | rust_dataset.txt | 513,579 | 512 | _context = || format!("Failed to make_lowest_pane_flexible");
let mut all_stacked_pane_positions = self.positions_in_stack(destination_pane_id)?;
let position_of_flexible_pane =
self.position_of_flexible_pane(&all_stacked_pane_positions)?;
if position_of_flexible_pane != 0 {
... |
rust_dataset_chunk_513580 | rust_dataset.txt | 513,580 | 512 | Panes;
use crate::tab::{MIN_TERMINAL_HEIGHT, MIN_TERMINAL_WIDTH};
use crate::{panes::PaneId, tab::Pane};
use std::cmp::{Ordering, Reverse};
use std::collections::{HashMap, HashSet};
use zellij_utils::data::{Direction, Resize, ResizeStrategy};
use zellij_utils::{
errors::prelude::*,
input::layout::SplitDirection... |
rust_dataset_chunk_513581 | rust_dataset.txt | 513,581 | 512 | pane_to_check = panes.get(pane_id)?;
let pane_geom = pane_to_check.current_geom();
if pane_geom.is_stacked() {
let mut stack_geom =
StackedPanes::new(self.panes.clone()).position_and_size_of_stack(&pane_id);
if let Some(stack_geom) = stack_geom.as_mut() {
... |
rust_dataset_chunk_513582 | rust_dataset.txt | 513,582 | 512 | | self.get_pane_geom(t).map(|p| p.x))
.collect()
};
// Only return those neighbors that are aligned and between pane borders
let (some_direction, other_direction) = match direction {
Dir::Left | Dir::Right => (Dir::Up, Dir::Down),
Dir::Down | Dir::Up => (... |
rust_dataset_chunk_513583 | rust_dataset.txt | 513,583 | 512 | .filter(|p| !self.pane_is_flexible(direction.into(), p).unwrap_or(false))
.copied()
.collect();
if !fixed_panes.is_empty() {
let mut pane_ids = vec![];
for fixed_pane in fixed_panes {
match fixed_pane {
... |
rust_dataset_chunk_513584 | rust_dataset.txt | 513,584 | 512 | behavior is to only increase pane size, unless the direction being resized to is
// a boundary. In this case, decrease size from the other side (invert strategy)!
let can_invert_strategy_if_needed = strategy.resize_increase() // Only invert when increasing
&& strategy.invert_on_boundaries ... |
rust_dataset_chunk_513585 | rust_dataset.txt | 513,585 | 512 | .filter_map(|p| self.get_pane_geom(p).map(|p| p.y))
.collect()
} else {
neighbor_terminals
.iter()
.filter_map(|p| self.get_pane_geom(p).map(|p| p.x))
.collect()
};
//... |
rust_dataset_chunk_513586 | rust_dataset.txt | 513,586 | 512 | if strategy.resize_decrease() && direction.is_horizontal() {
[*pane_id]
.iter()
.chain(&some_terminals)
.chain(&other_terminals)
.for_each(|pane| self.reduce_pane_width(pane, change_by));
neighbor_terminals
... |
rust_dataset_chunk_513587 | rust_dataset.txt | 513,587 | 512 | == pane.x + pane.cols.as_usize() {
// left aligned
aligned_panes[1] = Some(p_id);
}
}
for p_id in self.viewport_pane_ids_directly_above(pane_id) {
let pane = self
.get_pane_ge... |
rust_dataset_chunk_513588 | rust_dataset.txt | 513,588 | 512 | )
{
let result = self
.change_pane_size(pane_id, &main_strategy, change_by)
.and_then(|ret| {
Ok(ret
&& self.change_pane_size(pane_id, &sub_strategy, ch... |
rust_dataset_chunk_513589 | rust_dataset.txt | 513,589 | 512 | .get_pane_geom(pane_id)
.with_context(|| no_pane_id(pane_id))
.with_context(err_context)?;
let min_terminal_height = if pane.is_stacked() {
StackedPanes::new(self.panes.clone()).min_stack_height(pane_id)?
} else {
MIN_TERMINAL_HEIGHT
};... |
rust_dataset_chunk_513590 | rust_dataset.txt | 513,590 | 512 | _pane_is_stacked) = self
.panes
.borrow()
.get(id)
.map(|p| p.current_geom().is_stacked())
else {
return;
};
if current_pane_is_stacked {
let _ = StackedPanes::new(self.panes.clone()).increase_stack_width(&id, percent);
... |
rust_dataset_chunk_513591 | rust_dataset.txt | 513,591 | 512 | (pane);
}
if match direction {
Direction::Left => (pane.x + pane.cols.as_usize()) == pane_geom_to_check.x,
Direction::Down => {
pane.y == (pane_geom_to_check.y + pane_geom_to_check.rows.as_usize())
},
Direction::... |
rust_dataset_chunk_513592 | rust_dataset.txt | 513,592 | 512 | direction: &Direction,
) -> Result<BorderAndPaneIds> {
let err_context = || {
format!("failed to find contiguous panes {direction} from pane {id:?} with {alignment} alignment")
};
let input_error =
anyhow!("Invalid combination of alignment ({alignment}) and di... |
rust_dataset_chunk_513593 | rust_dataset.txt | 513,593 | 512 | (&D, &R) | (&U, &R) => pane.x == (pane_to_check.x + pane_to_check.cols.as_usize()),
_ => return Err(input_error).with_context(err_context),
} {
result.push((pid, pane));
}
}
let mut resize_border = match direction {
&L ... |
rust_dataset_chunk_513594 | rust_dataset.txt | 513,594 | 512 | }
fn pane_is_between_horizontal_borders(
&self,
id: &PaneId,
top_border_y: usize,
bottom_border_y: usize,
) -> bool {
self.get_pane_geom(id).map_or(false, |pane| {
pane.y >= top_border_y && pane.y + pane.rows.as_usize() <= bottom_border_y
})
}
... |
rust_dataset_chunk_513595 | rust_dataset.txt | 513,595 | 512 | _pane_id: &PaneId) -> Option<PaneId> {
let panes = self.panes.borrow();
let mut panes: Vec<(&PaneId, &&mut Box<dyn Pane>)> =
panes.iter().filter(|(_, p)| p.selectable()).collect();
panes.sort_by(|(_a_id, a_pane), (_b_id, b_pane)| {
if a_pane.y() == b_pane.y() {
... |
rust_dataset_chunk_513596 | rust_dataset.txt | 513,596 | 512 | ane.map(|p| p.pid())
}
pub fn progress_stack_up_if_in_stack(&mut self, source_pane_id: &PaneId) -> Option<PaneId> {
let destination_pane_id_in_stack = {
let panes = self.panes.borrow();
let source_pane = panes.get(source_pane_id)?;
let pane_list: Vec<(PaneId, &&mut Bo... |
rust_dataset_chunk_513597 | rust_dataset.txt | 513,597 | 512 | .map(|(_, (pid, _))| pid)
.copied();
destination_pane_id
};
match destination_pane_id_in_stack {
Some(destination_pane_id) => {
StackedPanes::new(self.panes.clone())
.move_down(source_pane_id, &destination_pane_id)
... |
rust_dataset_chunk_513598 | rust_dataset.txt | 513,598 | 512 | Ordering::Equal => a.active_at().cmp(&b.active_at()),
_ => x_comparison,
}
},
Direction::Right => {
let x_comparison = b.x().cmp(&a.x());
match x_comparison {
Ordering::Equal => a... |
rust_dataset_chunk_513599 | rust_dataset.txt | 513,599 | 512 | ();
let current_pane = panes.get(current_pane_id)?;
let panes: Vec<(PaneId, &&mut Box<dyn Pane>)> = panes
.iter()
.filter(|(_, p)| p.selectable())
.map(|(p_id, p)| (*p_id, p))
.collect();
let next_pane = panes
.iter()
.enume... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.