fix(layout-applier): logical index pane sorting (#3893)

* initial draft

* working with floating panes as well

* use the same method for applying an initial layout to tiled panes

* some refactoring

* all code paths working with logical positioning fallback!

* get tests to compile

* get e2e tests to pass

* fix e2e remote runner

* breadth-first layout sorting

* fix some bugs

* style(fmt): rustfmt

* style(fmt): remove comments
This commit is contained in:
Aram Drevekenin 2024-12-25 20:26:27 +01:00 committed by GitHub
parent 1923bace46
commit 86535f1612
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
53 changed files with 1056 additions and 842 deletions

View file

@ -457,6 +457,7 @@ impl RemoteRunner {
cols,
is_stacked: false,
is_pinned: false,
logical_position: None,
};
setup_remote_environment(&mut channel, win_size);
start_zellij(&mut channel);
@ -494,6 +495,7 @@ impl RemoteRunner {
cols,
is_stacked: false,
is_pinned: false,
logical_position: None,
};
setup_remote_environment(&mut channel, win_size);
start_zellij_mirrored_session(&mut channel);
@ -531,6 +533,7 @@ impl RemoteRunner {
cols,
is_stacked: false,
is_pinned: false,
logical_position: None,
};
setup_remote_environment(&mut channel, win_size);
start_zellij_mirrored_session_with_layout(&mut channel, layout_file_name);
@ -571,6 +574,7 @@ impl RemoteRunner {
cols,
is_stacked: false,
is_pinned: false,
logical_position: None,
};
setup_remote_environment(&mut channel, win_size);
start_zellij_mirrored_session_with_layout_and_viewport_serialization(
@ -618,6 +622,7 @@ impl RemoteRunner {
cols,
is_stacked: false,
is_pinned: false,
logical_position: None,
};
setup_remote_environment(&mut channel, win_size);
start_zellij_in_session(&mut channel, session_name, mirrored);
@ -655,6 +660,7 @@ impl RemoteRunner {
cols,
is_stacked: false,
is_pinned: false,
logical_position: None,
};
setup_remote_environment(&mut channel, win_size);
attach_to_existing_session(&mut channel, session_name);
@ -692,6 +698,7 @@ impl RemoteRunner {
cols,
is_stacked: false,
is_pinned: false,
logical_position: None,
};
setup_remote_environment(&mut channel, win_size);
start_zellij_without_frames(&mut channel);
@ -730,6 +737,7 @@ impl RemoteRunner {
cols,
is_stacked: false,
is_pinned: false,
logical_position: None,
};
setup_remote_environment(&mut channel, win_size);
start_zellij_with_config(&mut channel, &remote_path.to_string_lossy());

View file

@ -862,6 +862,7 @@ pub fn half_size_middle_geom(space: &Viewport, offset: usize) -> PaneGeom {
rows: Dimension::fixed(space.rows / 2),
is_stacked: false,
is_pinned: false,
logical_position: None,
};
geom.cols.set_inner(space.cols / 2);
geom.rows.set_inner(space.rows / 2);
@ -876,6 +877,7 @@ fn half_size_top_left_geom(space: &Viewport, offset: usize) -> PaneGeom {
rows: Dimension::fixed(space.rows / 3),
is_stacked: false,
is_pinned: false,
logical_position: None,
};
geom.cols.set_inner(space.cols / 3);
geom.rows.set_inner(space.rows / 3);
@ -890,6 +892,7 @@ fn half_size_top_right_geom(space: &Viewport, offset: usize) -> PaneGeom {
rows: Dimension::fixed(space.rows / 3),
is_stacked: false,
is_pinned: false,
logical_position: None,
};
geom.cols.set_inner(space.cols / 3);
geom.rows.set_inner(space.rows / 3);
@ -904,6 +907,7 @@ fn half_size_bottom_left_geom(space: &Viewport, offset: usize) -> PaneGeom {
rows: Dimension::fixed(space.rows / 3),
is_stacked: false,
is_pinned: false,
logical_position: None,
};
geom.cols.set_inner(space.cols / 3);
geom.rows.set_inner(space.rows / 3);
@ -918,6 +922,7 @@ fn half_size_bottom_right_geom(space: &Viewport, offset: usize) -> PaneGeom {
rows: Dimension::fixed(space.rows / 3),
is_stacked: false,
is_pinned: false,
logical_position: None,
};
geom.cols.set_inner(space.cols / 3);
geom.rows.set_inner(space.rows / 3);

View file

@ -282,6 +282,9 @@ impl FloatingPanes {
if let Some(is_pinned) = &floating_pane_layout.pinned {
position.is_pinned = *is_pinned;
}
if let Some(logical_position) = &floating_pane_layout.logical_position {
position.logical_position = Some(*logical_position);
}
if position.cols.as_usize() > viewport.cols {
position.cols = Dimension::fixed(viewport.cols);
}

View file

@ -722,6 +722,9 @@ impl Pane for PluginPane {
}
false
}
fn reset_logical_position(&mut self) {
self.geom.logical_position = None;
}
}
impl PluginPane {

View file

@ -842,6 +842,9 @@ impl Pane for TerminalPane {
}
false
}
fn reset_logical_position(&mut self) {
self.geom.logical_position = None;
}
}
impl TerminalPane {

View file

@ -183,6 +183,27 @@ impl TiledPanes {
.is_some();
has_room_for_new_pane || pane_grid.has_room_for_new_stacked_pane() || self.panes.is_empty()
}
pub fn assign_geom_for_pane_with_run(&mut self, run: Option<Run>) {
// here we're removing the first pane we find with this run instruction and re-adding it so
// that it gets a new geom similar to how it would when being added to the tab originally
if let Some(pane_id) = self
.panes
.iter()
.find_map(|(pid, p)| {
if p.invoked_with() == &run {
Some(pid)
} else {
None
}
})
.copied()
{
if let Some(pane) = self.panes.remove(&pane_id) {
self.add_pane(pane.pid(), pane, true);
}
}
}
fn add_pane(&mut self, pane_id: PaneId, mut pane: Box<dyn Pane>, should_relayout: bool) {
if self.panes.is_empty() {
self.panes.insert(pane_id, pane);

View file

@ -1407,11 +1407,13 @@ pub fn split(direction: SplitDirection, rect: &PaneGeom) -> Option<(PaneGeom, Pa
SplitDirection::Vertical => PaneGeom {
x: first_rect.x + 1,
cols: first_rect.cols,
logical_position: None,
..*rect
},
SplitDirection::Horizontal => PaneGeom {
y: first_rect.y + 1,
rows: first_rect.rows,
logical_position: None,
..*rect
},
};

View file

@ -2038,8 +2038,7 @@ impl Screen {
if let Some(plugin_pane_id) = tab.find_plugin(&run_plugin) {
tab_index_and_plugin_pane_id = Some((*tab_index, plugin_pane_id));
if move_to_focused_tab && focused_tab_index != *tab_index {
plugin_pane_to_move_to_active_tab =
tab.extract_pane(plugin_pane_id, true, Some(client_id));
plugin_pane_to_move_to_active_tab = tab.extract_pane(plugin_pane_id, true);
}
break;
@ -2055,7 +2054,6 @@ impl Screen {
plugin_pane_to_move_to_active_tab,
pane_id,
None,
Some(client_id),
)?;
} else {
new_active_tab.hide_floating_panes();
@ -2156,7 +2154,7 @@ impl Screen {
.with_context(err_context)?;
let pane_to_break_is_floating = active_tab.are_floating_panes_visible();
let active_pane = active_tab
.extract_pane(active_pane_id, false, Some(client_id))
.extract_pane(active_pane_id, false)
.with_context(err_context)?;
let active_pane_run_instruction = active_pane.invoked_with().clone();
let tab_index = self.get_new_tab_index();
@ -2169,7 +2167,7 @@ impl Screen {
let (mut tiled_panes_layout, mut floating_panes_layout) = default_layout.new_tab();
if pane_to_break_is_floating {
tab.show_floating_panes();
tab.add_floating_pane(active_pane, active_pane_id, None, Some(client_id))?;
tab.add_floating_pane(active_pane, active_pane_id, None)?;
if let Some(already_running_layout) = floating_panes_layout
.iter_mut()
.find(|i| i.run == active_pane_run_instruction)
@ -2221,7 +2219,7 @@ impl Screen {
for tab in all_tabs.values_mut() {
// here we pass None instead of the client_id we have because we do not need to
// necessarily trigger a relayout for this tab
if let Some(pane) = tab.extract_pane(pane_id, true, None).take() {
if let Some(pane) = tab.extract_pane(pane_id, true).take() {
extracted_panes.push(pane);
break;
}
@ -2276,7 +2274,7 @@ impl Screen {
.with_context(err_context)?;
let pane_to_break_is_floating = active_tab.are_floating_panes_visible();
let active_pane = active_tab
.extract_pane(active_pane_id, false, Some(client_id))
.extract_pane(active_pane_id, false)
.with_context(err_context)?;
(active_pane_id, active_pane, pane_to_break_is_floating)
};
@ -2293,12 +2291,7 @@ impl Screen {
if pane_to_break_is_floating {
new_active_tab.show_floating_panes();
new_active_tab.add_floating_pane(
active_pane,
active_pane_id,
None,
Some(client_id),
)?;
new_active_tab.add_floating_pane(active_pane, active_pane_id, None)?;
} else {
new_active_tab.hide_floating_panes();
new_active_tab.add_tiled_pane(active_pane, active_pane_id, Some(client_id))?;
@ -2348,7 +2341,7 @@ impl Screen {
}
// here we pass None instead of the client_id we have because we do not need to
// necessarily trigger a relayout for this tab
if let Some(pane) = tab.extract_pane(pane_id, true, None).take() {
if let Some(pane) = tab.extract_pane(pane_id, true).take() {
extracted_panes.push(pane);
break;
}
@ -3372,16 +3365,13 @@ pub(crate) fn screen_thread_main(
ScreenInstruction::ClosePane(id, client_id) => {
match client_id {
Some(client_id) => {
active_tab!(screen, client_id, |tab: &mut Tab| tab.close_pane(
id,
false,
Some(client_id)
));
active_tab!(screen, client_id, |tab: &mut Tab| tab
.close_pane(id, false,));
},
None => {
for tab in screen.tabs.values_mut() {
if tab.get_all_pane_ids().contains(&id) {
tab.close_pane(id, false, None);
tab.close_pane(id, false);
break;
}
}
@ -3904,7 +3894,7 @@ pub(crate) fn screen_thread_main(
active_tab_and_connected_client_id!(
screen,
client_id,
|tab: &mut Tab, client_id: ClientId| tab.previous_swap_layout(Some(client_id)),
|tab: &mut Tab, client_id: ClientId| tab.previous_swap_layout(),
?
);
screen.render(None)?;
@ -3915,7 +3905,7 @@ pub(crate) fn screen_thread_main(
active_tab_and_connected_client_id!(
screen,
client_id,
|tab: &mut Tab, client_id: ClientId| tab.next_swap_layout(Some(client_id), true),
|tab: &mut Tab, client_id: ClientId| tab.next_swap_layout(),
?
);
screen.render(None)?;

File diff suppressed because it is too large Load diff

View file

@ -508,7 +508,8 @@ pub trait Pane {
None
}
fn toggle_pinned(&mut self) {}
fn set_pinned(&mut self, should_be_pinned: bool) {}
fn set_pinned(&mut self, _should_be_pinned: bool) {}
fn reset_logical_position(&mut self) {}
}
#[derive(Clone, Debug)]
@ -731,12 +732,7 @@ impl Tab {
}
}
}
fn relayout_floating_panes(
&mut self,
client_id: Option<ClientId>,
search_backwards: bool,
refocus_pane: bool,
) -> Result<()> {
fn relayout_floating_panes(&mut self, search_backwards: bool) -> Result<()> {
if let Some(layout_candidate) = self
.swap_layouts
.swap_floating_panes(&self.floating_panes, search_backwards)
@ -762,41 +758,18 @@ impl Tab {
self.styled_underlines,
self.explicitly_disable_kitty_keyboard_protocol,
)
.apply_floating_panes_layout_to_existing_panes(
&layout_candidate,
refocus_pane,
client_id,
)?;
.apply_floating_panes_layout_to_existing_panes(&layout_candidate)?;
}
self.set_force_render();
Ok(())
}
fn relayout_tiled_panes(
&mut self,
client_id: Option<ClientId>,
search_backwards: bool,
refocus_pane: bool,
best_effort: bool,
) -> Result<()> {
fn relayout_tiled_panes(&mut self, search_backwards: bool) -> Result<()> {
if self.tiled_panes.fullscreen_is_active() {
self.tiled_panes.unset_fullscreen();
}
let refocus_pane = if self.swap_layouts.is_tiled_damaged() {
false
} else {
refocus_pane
};
if let Some(layout_candidate) = self
.swap_layouts
.swap_tiled_panes(&self.tiled_panes, search_backwards)
.or_else(|| {
if best_effort {
self.swap_layouts
.best_effort_tiled_layout(&self.tiled_panes)
} else {
None
}
})
{
LayoutApplier::new(
&self.viewport,
@ -819,11 +792,7 @@ impl Tab {
self.styled_underlines,
self.explicitly_disable_kitty_keyboard_protocol,
)
.apply_tiled_panes_layout_to_existing_panes(
&layout_candidate,
refocus_pane,
client_id,
)?;
.apply_tiled_panes_layout_to_existing_panes(&layout_candidate)?;
}
self.tiled_panes.reapply_pane_frames();
let display_area = *self.display_area.borrow();
@ -832,28 +801,24 @@ impl Tab {
self.set_should_clear_display_before_rendering();
Ok(())
}
pub fn previous_swap_layout(&mut self, client_id: Option<ClientId>) -> Result<()> {
pub fn previous_swap_layout(&mut self) -> Result<()> {
let search_backwards = true;
if self.floating_panes.panes_are_visible() {
self.relayout_floating_panes(client_id, search_backwards, true)?;
self.relayout_floating_panes(search_backwards)?;
} else {
self.relayout_tiled_panes(client_id, search_backwards, true, false)?;
self.relayout_tiled_panes(search_backwards)?;
}
self.senders
.send_to_pty_writer(PtyWriteInstruction::ApplyCachedResizes)
.with_context(|| format!("failed to update plugins with mode info"))?;
Ok(())
}
pub fn next_swap_layout(
&mut self,
client_id: Option<ClientId>,
refocus_pane: bool,
) -> Result<()> {
pub fn next_swap_layout(&mut self) -> Result<()> {
let search_backwards = false;
if self.floating_panes.panes_are_visible() {
self.relayout_floating_panes(client_id, search_backwards, refocus_pane)?;
self.relayout_floating_panes(search_backwards)?;
} else {
self.relayout_tiled_panes(client_id, search_backwards, refocus_pane, false)?;
self.relayout_tiled_panes(search_backwards)?;
}
self.senders
.send_to_pty_writer(PtyWriteInstruction::ApplyCachedResizes)
@ -1008,7 +973,7 @@ impl Tab {
if let Some(focused_floating_pane_id) = self.floating_panes.active_pane_id(client_id) {
if self.tiled_panes.has_room_for_new_pane() {
let floating_pane_to_embed = self
.extract_pane(focused_floating_pane_id, true, Some(client_id))
.extract_pane(focused_floating_pane_id, true)
.with_context(|| format!(
"failed to find floating pane (ID: {focused_floating_pane_id:?}) to embed for client {client_id}",
))
@ -1026,16 +991,9 @@ impl Tab {
// don't close the only pane on screen...
return Ok(());
}
if let Some(embedded_pane_to_float) =
self.extract_pane(focused_pane_id, true, Some(client_id))
{
if let Some(embedded_pane_to_float) = self.extract_pane(focused_pane_id, true) {
self.show_floating_panes();
self.add_floating_pane(
embedded_pane_to_float,
focused_pane_id,
None,
Some(client_id),
)?;
self.add_floating_pane(embedded_pane_to_float, focused_pane_id, None)?;
}
}
Ok(())
@ -1053,7 +1011,7 @@ impl Tab {
if self.floating_panes.panes_contain(&pane_id) {
if self.tiled_panes.has_room_for_new_pane() {
let floating_pane_to_embed = self
.extract_pane(pane_id, true, None)
.extract_pane(pane_id, true)
.with_context(|| {
format!("failed to find floating pane (ID: {pane_id:?}) to embed",)
})
@ -1066,8 +1024,8 @@ impl Tab {
// don't close the only pane on screen...
return Ok(());
}
if let Some(embedded_pane_to_float) = self.extract_pane(pane_id, true, None) {
self.add_floating_pane(embedded_pane_to_float, pane_id, None, None)?;
if let Some(embedded_pane_to_float) = self.extract_pane(pane_id, true) {
self.add_floating_pane(embedded_pane_to_float, pane_id, None)?;
}
}
Ok(())
@ -1212,7 +1170,7 @@ impl Tab {
.insert(pid, (is_scrollback_editor, new_pane));
Ok(())
} else if self.floating_panes.panes_are_visible() {
self.add_floating_pane(new_pane, pid, floating_pane_coordinates, client_id)
self.add_floating_pane(new_pane, pid, floating_pane_coordinates)
} else {
self.add_tiled_pane(new_pane, pid, client_id)
}
@ -1914,7 +1872,7 @@ impl Tab {
should_update_ui = true;
},
Some(AdjustedInput::CloseThisPane) => {
self.close_pane(PaneId::Terminal(active_terminal_id), false, None);
self.close_pane(PaneId::Terminal(active_terminal_id), false);
should_update_ui = true;
},
Some(AdjustedInput::DropToShellInThisPane { working_dir }) => {
@ -2326,12 +2284,12 @@ impl Tab {
// we do this only for floating panes, because the constraint system takes care of the
// tiled panes
self.swap_layouts.set_is_floating_damaged();
let _ = self.relayout_floating_panes(None, false, false);
let _ = self.relayout_floating_panes(false);
}
if self.auto_layout && !self.swap_layouts.is_tiled_damaged() && !self.is_fullscreen_active()
{
self.swap_layouts.set_is_tiled_damaged();
let _ = self.relayout_tiled_panes(None, false, false, true);
let _ = self.relayout_tiled_panes(false);
}
self.set_should_clear_display_before_rendering();
self.senders
@ -2673,7 +2631,7 @@ impl Tab {
self.senders
.send_to_pty(PtyInstruction::ClosePane(pid))
.context("failed to close down to max terminals")?;
self.close_pane(pid, false, None);
self.close_pane(pid, false);
}
}
Ok(())
@ -2729,12 +2687,7 @@ impl Tab {
self.draw_pane_frames,
);
}
pub fn close_pane(
&mut self,
id: PaneId,
ignore_suppressed_panes: bool,
client_id: Option<ClientId>,
) {
pub fn close_pane(&mut self, id: PaneId, ignore_suppressed_panes: bool) {
// we need to ignore suppressed panes when we toggle a pane to be floating/embedded(tiled)
// this is because in that case, while we do use this logic, we're not actually closing the
// pane, we're moving it
@ -2763,7 +2716,7 @@ impl Tab {
self.swap_layouts.set_is_floating_damaged();
// only relayout if the user is already "in" a layout, otherwise this might be
// confusing
let _ = self.next_swap_layout(client_id, false);
let _ = self.next_swap_layout();
}
} else {
if self.tiled_panes.fullscreen_is_active() {
@ -2776,7 +2729,7 @@ impl Tab {
self.swap_layouts.set_is_tiled_damaged();
// only relayout if the user is already "in" a layout, otherwise this might be
// confusing
let _ = self.next_swap_layout(client_id, false);
let _ = self.next_swap_layout();
}
};
let _ = self.senders.send_to_plugin(PluginInstruction::Update(vec![(
@ -2789,12 +2742,17 @@ impl Tab {
&mut self,
id: PaneId,
dont_swap_if_suppressed: bool,
client_id: Option<ClientId>,
) -> Option<Box<dyn Pane>> {
if !dont_swap_if_suppressed && self.suppressed_panes.contains_key(&id) {
// this is done for the scrollback editor
return match self.replace_pane_with_suppressed_pane(id) {
Ok(pane) => pane,
Ok(mut pane) => {
// we do this so that the logical index will not affect ordering in the target tab
if let Some(pane) = pane.as_mut() {
pane.reset_logical_position();
}
pane
},
Err(e) => {
Err::<(), _>(e)
.with_context(|| format!("failed to close pane {:?}", id))
@ -2804,7 +2762,7 @@ impl Tab {
};
}
if self.floating_panes.panes_contain(&id) {
let closed_pane = self.floating_panes.remove_pane(id);
let mut closed_pane = self.floating_panes.remove_pane(id);
self.floating_panes.move_clients_out_of_pane(id);
if !self.floating_panes.has_panes() {
self.hide_floating_panes();
@ -2818,21 +2776,29 @@ impl Tab {
self.swap_layouts.set_is_floating_damaged();
// only relayout if the user is already "in" a layout, otherwise this might be
// confusing
let _ = self.next_swap_layout(client_id, false);
let _ = self.next_swap_layout();
}
// we do this so that the logical index will not affect ordering in the target tab
if let Some(closed_pane) = closed_pane.as_mut() {
closed_pane.reset_logical_position();
}
closed_pane
} else if self.tiled_panes.panes_contain(&id) {
if self.tiled_panes.fullscreen_is_active() {
self.tiled_panes.unset_fullscreen();
}
let closed_pane = self.tiled_panes.remove_pane(id);
let mut closed_pane = self.tiled_panes.remove_pane(id);
self.set_force_render();
self.tiled_panes.set_force_render();
if self.auto_layout && !self.swap_layouts.is_tiled_damaged() {
self.swap_layouts.set_is_tiled_damaged();
// only relayout if the user is already "in" a layout, otherwise this might be
// confusing
let _ = self.next_swap_layout(client_id, false);
let _ = self.next_swap_layout();
}
// we do this so that the logical index will not affect ordering in the target tab
if let Some(closed_pane) = closed_pane.as_mut() {
closed_pane.reset_logical_position();
}
closed_pane
} else if self.suppressed_panes.contains_key(&id) {
@ -2923,7 +2889,7 @@ impl Tab {
if self.floating_panes.panes_are_visible() {
if let Some(active_floating_pane_id) = self.floating_panes.active_pane_id(client_id) {
self.close_pane(active_floating_pane_id, false, Some(client_id));
self.close_pane(active_floating_pane_id, false);
self.senders
.send_to_pty(PtyInstruction::ClosePane(active_floating_pane_id))
.with_context(|| err_context(active_floating_pane_id))?;
@ -2931,7 +2897,7 @@ impl Tab {
}
}
if let Some(active_pane_id) = self.tiled_panes.get_active_pane_id(client_id) {
self.close_pane(active_pane_id, false, Some(client_id));
self.close_pane(active_pane_id, false);
self.senders
.send_to_pty(PtyInstruction::ClosePane(active_pane_id))
.with_context(|| err_context(active_pane_id))?;
@ -4144,7 +4110,7 @@ impl Tab {
pane.1.set_selectable(true);
if should_float {
self.show_floating_panes();
self.add_floating_pane(pane.1, pane_id, None, Some(client_id))
self.add_floating_pane(pane.1, pane_id, None)
} else {
self.hide_floating_panes();
self.add_tiled_pane(pane.1, pane_id, Some(client_id))
@ -4157,8 +4123,7 @@ impl Tab {
match self.suppressed_panes.remove(&pane_id) {
Some(pane) => {
self.show_floating_panes();
self.add_floating_pane(pane.1, pane_id, None, None)
.non_fatal();
self.add_floating_pane(pane.1, pane_id, None).non_fatal();
self.floating_panes.focus_pane_for_all_clients(pane_id);
},
None => {
@ -4171,7 +4136,7 @@ impl Tab {
// not take it out of there when another pane is closed (eg. like happens with the
// scrollback editor), but it has to take itself out on its own (eg. a plugin using the
// show_self() method)
if let Some(pane) = self.extract_pane(pane_id, true, client_id) {
if let Some(pane) = self.extract_pane(pane_id, true) {
let is_scrollback_editor = false;
self.suppressed_panes
.insert(pane_id, (is_scrollback_editor, pane));
@ -4198,7 +4163,6 @@ impl Tab {
mut pane: Box<dyn Pane>,
pane_id: PaneId,
floating_pane_coordinates: Option<FloatingPaneCoordinates>,
client_id: Option<ClientId>,
) -> Result<()> {
let err_context = || format!("failed to add floating pane");
if let Some(mut new_pane_geom) = self.floating_panes.find_room_for_new_pane() {
@ -4223,7 +4187,7 @@ impl Tab {
// confusing and not what the user intends
self.swap_layouts.set_is_floating_damaged(); // we do this so that we won't skip to the
// next layout
self.next_swap_layout(client_id, true)?;
self.next_swap_layout()?;
}
Ok(())
}
@ -4256,7 +4220,7 @@ impl Tab {
// confusing and not what the user intends
self.swap_layouts.set_is_tiled_damaged(); // we do this so that we won't skip to the
// next layout
self.next_swap_layout(client_id, true)?;
self.next_swap_layout()?;
}
Ok(())
}

View file

@ -244,12 +244,18 @@ impl SwapLayouts {
Some(swap_layout) => {
for (constraint, layout) in swap_layout.0.iter() {
if self.state_fits_tiled_panes_constraint(constraint, tiled_panes) {
let focus_layout_if_not_focused = true;
let display_area = self.display_area.borrow();
// TODO: reuse the assets from position_panes_in_space here?
let pane_count = tiled_panes.visible_panes_count();
let display_area = PaneGeom::from(&*display_area);
if layout
.position_panes_in_space(&display_area, Some(pane_count), false)
.position_panes_in_space(
&display_area,
Some(pane_count),
false,
focus_layout_if_not_focused,
)
.is_ok()
{
return Some(layout.clone());
@ -274,12 +280,18 @@ impl SwapLayouts {
) -> Option<TiledPaneLayout> {
for swap_layout in self.swap_tiled_layouts.iter() {
for (_constraint, layout) in swap_layout.0.iter() {
let focus_layout_if_not_focused = true;
let display_area = self.display_area.borrow();
// TODO: reuse the assets from position_panes_in_space here?
let pane_count = tiled_panes.visible_panes_count();
let display_area = PaneGeom::from(&*display_area);
if layout
.position_panes_in_space(&display_area, Some(pane_count), false)
.position_panes_in_space(
&display_area,
Some(pane_count),
false,
focus_layout_if_not_focused,
)
.is_ok()
{
return Some(layout.clone());

View file

@ -1,17 +1,17 @@
---
source: zellij-server/src/tab/./unit/tab_integration_tests.rs
assertion_line: 5109
assertion_line: 6660
expression: snapshot
---
00 (C): I am a tab bar
01 (C): ┌ command2 ─────────────────────────────┐┌ Pane #2 ─────────────────────────────┐┌ command1 ────────────────────────────┐
01 (C): ┌ command1 ─────────────────────────────┐┌ Pane #2 ─────────────────────────────┐┌ command2 ────────────────────────────┐
02 (C): │ ││ ││ │
03 (C): │ ││ ││ │
04 (C): │ ││ ││ │
05 (C): │ ││ ││ │
06 (C): │ ││ ││ │
07 (C): │ ││ ││ │
08 (C): │ Waiting to run: command2 ││ ││ Waiting to run: command1
08 (C): │ Waiting to run: command1 ││ ││ Waiting to run: command2
09 (C): │ ││ ││ │
10 (C): │<ENTER> run, <ESC> drop to shell, <Ctrl││ ││<ENTER> run, <ESC> drop to shell, <Ctr│
11 (C): │-c> exit ││ ││l-c> exit │

View file

@ -1,6 +1,6 @@
---
source: zellij-server/src/tab/./unit/tab_integration_tests.rs
assertion_line: 4299
assertion_line: 5546
expression: snapshot
---
00 (C): ┌ Pane #1 ──────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
@ -17,8 +17,8 @@ expression: snapshot
11 (C): │ │
12 (C): └───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
13 (C): ┌ Pane #2 ────────────────────────────────────────────────────────┐┌ Pane #4 ───────────────────────────────────────────┐
14 (C): │ │┌ Pane #3 ───────────────────────────────────────────┐
15 (C): │ │┌ Pane #5 ───────────────────────────────────────────┐
14 (C): │ │┌ Pane #5 ───────────────────────────────────────────┐
15 (C): │ │┌ Pane #6 ───────────────────────────────────────────┐
16 (C): │ ││ │
17 (C): │ ││ │
18 (C): │ ││ │
@ -31,7 +31,7 @@ expression: snapshot
25 (C): │ ││ │
26 (C): │ ││ │
27 (C): └─────────────────────────────────────────────────────────────────┘└────────────────────────────────────────────────────┘
28 (C): ┌ Pane #6 ──────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
28 (C): ┌ Pane #3 ──────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
29 (C): │ │
30 (C): │ │
31 (C): │ │

View file

@ -1,6 +1,6 @@
---
source: zellij-server/src/tab/./unit/tab_integration_tests.rs
assertion_line: 4237
assertion_line: 5446
expression: snapshot
---
00 (C): ┌ Pane #1 ──────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
@ -17,8 +17,8 @@ expression: snapshot
11 (C): │ │
12 (C): └───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
13 (C): ┌ Pane #2 ──────────────────────────────────────────────────┐┌ Pane #4 ─────────────────────────────────────────────────┐
14 (C): │ │┌ Pane #3 ─────────────────────────────────────────────────┐
15 (C): │ │┌ Pane #5 ─────────────────────────────────────────────────┐
14 (C): │ │┌ Pane #5 ─────────────────────────────────────────────────┐
15 (C): │ │┌ Pane #6 ─────────────────────────────────────────────────┐
16 (C): │ ││ │
17 (C): │ ││ │
18 (C): │ ││ │
@ -28,7 +28,7 @@ expression: snapshot
22 (C): │ ││ │
23 (C): │ ││ │
24 (C): └───────────────────────────────────────────────────────────┘└──────────────────────────────────────────────────────────┘
25 (C): ┌ Pane #6 ──────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
25 (C): ┌ Pane #3 ──────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
26 (C): │ │
27 (C): │ │
28 (C): │ │

View file

@ -1,6 +1,6 @@
---
source: zellij-server/src/tab/./unit/tab_integration_tests.rs
assertion_line: 4024
assertion_line: 5240
expression: snapshot
---
00 (C): ┌ Pane #1 ──────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
@ -17,8 +17,8 @@ expression: snapshot
11 (C): │ │
12 (C): └───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
13 (C): ┌ Pane #2 ───────────────────────────────────────────┐┌ Pane #4 ────────────────────────────────────────────────────────┐
14 (C): │ │┌ Pane #3 ────────────────────────────────────────────────────────┐
15 (C): │ │┌ Pane #5 ────────────────────────────────────────────────────────┐
14 (C): │ │┌ Pane #5 ────────────────────────────────────────────────────────┐
15 (C): │ │┌ Pane #6 ────────────────────────────────────────────────────────┐
16 (C): │ ││ │
17 (C): │ ││ │
18 (C): │ ││ │
@ -31,7 +31,7 @@ expression: snapshot
25 (C): │ ││ │
26 (C): │ ││ │
27 (C): └────────────────────────────────────────────────────┘└─────────────────────────────────────────────────────────────────┘
28 (C): ┌ Pane #6 ──────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
28 (C): ┌ Pane #3 ──────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
29 (C): │ │
30 (C): │ │
31 (C): │ │

View file

@ -1,6 +1,6 @@
---
source: zellij-server/src/tab/./unit/tab_integration_tests.rs
assertion_line: 3961
assertion_line: 5139
expression: snapshot
---
00 (C): ┌ Pane #1 ──────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
@ -17,8 +17,8 @@ expression: snapshot
11 (C): │ │
12 (C): └───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
13 (C): ┌ Pane #2 ──────────────────────────────────────────────────┐┌ Pane #4 ─────────────────────────────────────────────────┐
14 (C): │ │┌ Pane #3 ─────────────────────────────────────────────────┐
15 (C): │ │┌ Pane #5 ─────────────────────────────────────────────────┐
14 (C): │ │┌ Pane #5 ─────────────────────────────────────────────────┐
15 (C): │ │┌ Pane #6 ─────────────────────────────────────────────────┐
16 (C): │ ││ │
17 (C): │ ││ │
18 (C): │ ││ │
@ -31,7 +31,7 @@ expression: snapshot
25 (C): │ ││ │
26 (C): │ ││ │
27 (C): └───────────────────────────────────────────────────────────┘└──────────────────────────────────────────────────────────┘
28 (C): ┌ Pane #6 ──────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
28 (C): ┌ Pane #3 ──────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
29 (C): │ │
30 (C): │ │
31 (C): │ │

View file

@ -1,6 +1,6 @@
---
source: zellij-server/src/tab/./unit/tab_integration_tests.rs
assertion_line: 4346
assertion_line: 5855
expression: snapshot
---
00 (C): ┌ Pane #1 ──────────────────────────────────────────────────┐┌ Pane #3 ─────────────────────────────────────────────────┐

View file

@ -1,9 +1,9 @@
---
source: zellij-server/src/tab/./unit/tab_integration_tests.rs
assertion_line: 3699
assertion_line: 4932
expression: snapshot
---
00 (C): ┌ Pane #1 ──────────────────────────────────────────────────┐┌ Pane #3 ─────────────────────────────────────────────────┐
00 (C): ┌ Pane #1 ──────────────────────────────────────────────────┐┌ Pane #2 ─────────────────────────────────────────────────┐
01 (C): │ │┌ Pane #4 ─────────────────────────────────────────────────┐
02 (C): │ ││ │
03 (C): │ ││ │

View file

@ -1,6 +1,6 @@
---
source: zellij-server/src/tab/./unit/tab_integration_tests.rs
assertion_line: 4517
assertion_line: 6163
expression: snapshot
---
00 (C): ┌ Pane #1 ──────────────────────────────────────────────────┐┌ Pane #3 ─────────────────────────────────────────────────┐

View file

@ -1,6 +1,6 @@
---
source: zellij-server/src/tab/./unit/tab_integration_tests.rs
assertion_line: 4628
assertion_line: 6366
expression: snapshot
---
00 (C): ┌ Pane #1 ──────────────────────────────────────────────────┐┌ Pane #3 ─────────────────────────────────────────────────┐

View file

@ -1,6 +1,6 @@
---
source: zellij-server/src/tab/./unit/tab_integration_tests.rs
assertion_line: 4399
assertion_line: 5954
expression: snapshot
---
00 (C): ┌ Pane #1 ──────────────────────────────────────────────────┐┌ Pane #3 ─────────────────────────────────────────────────┐

View file

@ -1,6 +1,6 @@
---
source: zellij-server/src/tab/./unit/tab_integration_tests.rs
assertion_line: 4454
assertion_line: 6055
expression: snapshot
---
00 (C): ┌ Pane #1 ──────────────────────────────────────────────────┐┌ Pane #3 ─────────────────────────────────────────────────┐

View file

@ -1,22 +1,22 @@
---
source: zellij-server/src/tab/./unit/tab_integration_tests.rs
assertion_line: 5007
assertion_line: 6564
expression: snapshot
---
00 (C): I am a
01 (C): status bar
02 (C): ┌ command1 ─────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
02 (C): ┌ command2 ─────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
03 (C): │ │
04 (C): │ Waiting to run: command1
04 (C): │ Waiting to run: command2
05 (C): │ │
06 (C): │ <ENTER> run, <ESC> drop to shell, <Ctrl-c> exit │
07 (C): └─ <ENTER> run, <ESC> drop to shell, <Ctrl-c> exit ─────────────────────────────────────────────────────────────────────┘
08 (C): ┌ command2 ─────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
07 (C): └───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
08 (C): ┌ command1 ─────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
09 (C): │ │
10 (C): │ Waiting to run: command2
10 (C): │ Waiting to run: command1
11 (C): │ │
12 (C): │ <ENTER> run, <ESC> drop to shell, <Ctrl-c> exit │
13 (C): └───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
13 (C): └─ <ENTER> run, <ESC> drop to shell, <Ctrl-c> exit ─────────────────────────────────────────────────────────────────────┘
14 (C): ┌ Pane #2 ──────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
15 (C): │ │
16 (C): │ │

View file

@ -1,10 +1,10 @@
---
source: zellij-server/src/tab/./unit/tab_integration_tests.rs
assertion_line: 8040
assertion_line: 8043
expression: snapshot
---
00 (C): ┌ Pane #1 ──────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
01 (C): │ ┌ Pane #3 ─────────────────────────────────── PIN [ ] ┐ ┌ Pane #2 ─────────────────────────────────── PIN [ ] ┐ │
01 (C): │ ┌ Pane #2 ─────────────────────────────────── PIN [ ] ┐ ┌ Pane #3 ─────────────────────────────────── PIN [ ] ┐ │
02 (C): │ │ │ │ │ │
03 (C): │ │ │ │ │ │
04 (C): │ │ │ │ │ │

View file

@ -1,6 +1,6 @@
---
source: zellij-server/src/tab/./unit/tab_integration_tests.rs
assertion_line: 5099
assertion_line: 7117
expression: snapshot
---
00 (C): ┌ Pane #1 ──────────────────────────────────────────────────┐┌ Pane #2 ─────────────────────────────────────────────────┐
@ -8,17 +8,17 @@ expression: snapshot
02 (C): │ ││ │
03 (C): │ ││ │
04 (C): │ │└──────────────────────────────────────────────────────────┘
05 (C): │ │┌ Pane #3 ─────────────────────────────────────────────────┐
05 (C): │ │┌ Pane #4 ─────────────────────────────────────────────────┐
06 (C): │ ││ │
07 (C): │ ││ │
08 (C): │ ││ │
09 (C): └───────────────────────────────────────────────────────────┘└──────────────────────────────────────────────────────────┘
10 (C): ┌ Pane #6 ──────────────────────────────────────────────────┐┌ Pane #4 ─────────────────────────────────────────────────┐
10 (C): ┌ Pane #3 ──────────────────────────────────────────────────┐┌ Pane #5 ─────────────────────────────────────────────────┐
11 (C): │ ││ │
12 (C): │ ││ │
13 (C): │ ││ │
14 (C): │ │└──────────────────────────────────────────────────────────┘
15 (C): │ │┌ Pane #5 ─────────────────────────────────────────────────┐
15 (C): │ │┌ Pane #6 ─────────────────────────────────────────────────┐
16 (C): │ ││ │
17 (C): │ ││ │
18 (C): │ ││ │

View file

@ -1,6 +1,6 @@
---
source: zellij-server/src/tab/./unit/tab_integration_tests.rs
assertion_line: 5099
assertion_line: 7119
expression: snapshot
---
00 (C): ┌ Pane #1 ──────────────────────────────────────────────────┐┌ Pane #2 ─────────────────────────────────────────────────┐
@ -8,17 +8,17 @@ expression: snapshot
02 (C): │ ││ │
03 (C): │ ││ │
04 (C): │ │└──────────────────────────────────────────────────────────┘
05 (C): │ │┌ Pane #3 ─────────────────────────────────────────────────┐
05 (C): │ │┌ Pane #5 ─────────────────────────────────────────────────┐
06 (C): └───────────────────────────────────────────────────────────┘│ │
07 (C): ┌ Pane #6 ──────────────────────────────────────────────────┐│ │
07 (C): ┌ Pane #3 ──────────────────────────────────────────────────┐│ │
08 (C): │ ││ │
09 (C): │ │└──────────────────────────────────────────────────────────┘
10 (C): │ │┌ Pane #4 ─────────────────────────────────────────────────┐
10 (C): │ │┌ Pane #6 ─────────────────────────────────────────────────┐
11 (C): │ ││ │
12 (C): │ ││ │
13 (C): └───────────────────────────────────────────────────────────┘│ │
14 (C): ┌ Pane #7 ──────────────────────────────────────────────────┐└──────────────────────────────────────────────────────────┘
15 (C): │ │┌ Pane #5 ─────────────────────────────────────────────────┐
14 (C): ┌ Pane #4 ──────────────────────────────────────────────────┐└──────────────────────────────────────────────────────────┘
15 (C): │ │┌ Pane #7 ─────────────────────────────────────────────────┐
16 (C): │ ││ │
17 (C): │ ││ │
18 (C): │ ││ │

View file

@ -1,6 +1,6 @@
---
source: zellij-server/src/tab/./unit/tab_integration_tests.rs
assertion_line: 5099
assertion_line: 7119
expression: snapshot
---
00 (C): ┌ Pane #1 ──────────────────────────────────────────────────┐┌ Pane #2 ─────────────────────────────────────────────────┐
@ -8,17 +8,17 @@ expression: snapshot
02 (C): │ ││ │
03 (C): │ ││ │
04 (C): └───────────────────────────────────────────────────────────┘└──────────────────────────────────────────────────────────┘
05 (C): ┌ Pane #6 ──────────────────────────────────────────────────┐┌ Pane #3 ─────────────────────────────────────────────────┐
05 (C): ┌ Pane #3 ──────────────────────────────────────────────────┐┌ Pane #6 ─────────────────────────────────────────────────┐
06 (C): │ ││ │
07 (C): │ ││ │
08 (C): │ ││ │
09 (C): └───────────────────────────────────────────────────────────┘└──────────────────────────────────────────────────────────┘
10 (C): ┌ Pane #7 ──────────────────────────────────────────────────┐┌ Pane #4 ─────────────────────────────────────────────────┐
10 (C): ┌ Pane #4 ──────────────────────────────────────────────────┐┌ Pane #7 ─────────────────────────────────────────────────┐
11 (C): │ ││ │
12 (C): │ ││ │
13 (C): │ ││ │
14 (C): └───────────────────────────────────────────────────────────┘└──────────────────────────────────────────────────────────┘
15 (C): ┌ Pane #8 ──────────────────────────────────────────────────┐┌ Pane #5 ─────────────────────────────────────────────────┐
15 (C): ┌ Pane #5 ──────────────────────────────────────────────────┐┌ Pane #8 ─────────────────────────────────────────────────┐
16 (C): │ ││ │
17 (C): │ ││ │
18 (C): │ ││ │

View file

@ -1,9 +1,9 @@
---
source: zellij-server/src/tab/./unit/tab_integration_tests.rs
assertion_line: 4667
assertion_line: 6466
expression: snapshot
---
00 (C): ┌ Pane #5 ──────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
00 (C): ┌ Pane #1 ──────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
01 (C): │ │
02 (C): │ │
03 (C): │ │

View file

@ -1,6 +1,6 @@
---
source: zellij-server/src/tab/./unit/tab_integration_tests.rs
assertion_line: 7793
assertion_line: 7796
expression: snapshot
---
00 (C): ┌ Pane #1 ──────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
@ -18,7 +18,7 @@ expression: snapshot
12 (C): │ │ │ │ │
13 (C): │ │ │ │ │
14 (C): │ └──────────────────────────────────────────────────────────┘ │ │
15 (C): │ │ │ <ENTER> run, <ESC> drop to shell, <Ctrl-c> exit │ │
15 (C): │ │ │ │ │
16 (C): │ └─│ │ │
17 (C): │ │ │ │
18 (C): │ └──────────────────────────────────────────────────────────┘ │

View file

@ -1,6 +1,6 @@
---
source: zellij-server/src/tab/./unit/tab_integration_tests.rs
assertion_line: 4831
assertion_line: 6753
expression: snapshot
---
00 (C): I am a
@ -11,13 +11,13 @@ expression: snapshot
05 (C): │ │
06 (C): │ │
07 (C): └───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
08 (C): ┌ Pane #2 ──────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
08 (C): ┌ Pane #3 ──────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
09 (C): │ │
10 (C): │ │
11 (C): │ │
12 (C): │ │
13 (C): └───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
14 (C): ┌ Pane #3 ──────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
14 (C): ┌ Pane #2 ──────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
15 (C): │ │
16 (C): │ │
17 (C): │ │

View file

@ -1,26 +1,26 @@
---
source: zellij-server/src/tab/./unit/tab_integration_tests.rs
assertion_line: 5307
assertion_line: 6849
expression: snapshot
---
00 (C): I am a
01 (C): status bar
02 (C): ┌ Pane #2 ──────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
02 (C): ┌ command1 ─────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
03 (C): │ │
04 (C): │
04 (C): │ Waiting to run: command1
05 (C): │ │
06 (C): │
07 (C): └───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
08 (C): ┌ command1 ─────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
06 (C): │ <ENTER> run, <ESC> drop to shell, <Ctrl-c> exit
07 (C): └─ <ENTER> run, <ESC> drop to shell, <Ctrl-c> exit ─────────────────────────────────────────────────────────────────────┘
08 (C): ┌ command2 ─────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
09 (C): │ │
10 (C): │ Waiting to run: command1
10 (C): │ Waiting to run: command2
11 (C): │ │
12 (C): │ <ENTER> run, <ESC> drop to shell, <Ctrl-c> exit │
13 (C): └─ <ENTER> run, <ESC> drop to shell, <Ctrl-c> exit ─────────────────────────────────────────────────────────────────────┘
14 (C): ┌ command2 ─────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
15 (C): │ Waiting to run: command2
13 (C): └───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
14 (C): ┌ Pane #2 ──────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
15 (C): │
16 (C): │ │
17 (C): │ <ENTER> run, <ESC> drop to shell, <Ctrl-c> exit
17 (C): │
18 (C): └───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
19 (C): I am a tab bar

View file

@ -1,9 +1,9 @@
---
source: zellij-server/src/tab/./unit/tab_integration_tests.rs
assertion_line: 5510
assertion_line: 7019
expression: snapshot
---
00 (C): ┌ Pane #2 ──────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
00 (C): ┌ zellij:tab-bar ───────────────────────────────────────────────────────────────────────────────────────────────────────┐
01 (C): └───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
02 (C): ┌ command1 ─────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
03 (C): │ │
@ -11,16 +11,16 @@ expression: snapshot
05 (C): │ │
06 (C): │ <ENTER> run, <ESC> drop to shell, <Ctrl-c> exit │
07 (C): └─ <ENTER> run, <ESC> drop to shell, <Ctrl-c> exit ─────────────────────────────────────────────────────────────────────┘
08 (C): ┌ command2 ─────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
09 (C): │
10 (C): │ Waiting to run: command2
08 (C): ┌ zellij:status-bar ────────────────────────────────────────────────────────────────────────────────────────────────────┐
09 (C): │I am a
10 (C): │status bar
11 (C): │ │
12 (C): │ <ENTER> run, <ESC> drop to shell, <Ctrl-c> exit
12 (C): │
13 (C): └───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
14 (C): ┌ zellij:status-bar ────────────────────────────────────────────────────────────────────────────────────────────────────┐
15 (C): │I am a
16 (C): │status bar
14 (C): ┌ Pane #2 ──────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
15 (C): │
16 (C): │
17 (C): │ │
18 (C): └───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
19 (C): ┌ zellij:tab-bar ───────────────────────────────────────────────────────────────────────────────────────────────────────┐
19 (C): ┌ command2 ─────────────────────────────────────────────────────────────────────────────────────────────────────────────┐

View file

@ -1,9 +1,9 @@
---
source: zellij-server/src/tab/./unit/tab_integration_tests.rs
assertion_line: 2170
assertion_line: 3375
expression: snapshot
---
00 (C): ┌ Pane #1 ──────────────────────────────┐┌ Pane #2 ─────────────────────────────┐┌ Pane #6 ─────────────────────────────┐
00 (C): ┌ Pane #1 ──────────────────────────────┐┌ Pane #2 ─────────────────────────────┐┌ Pane #3 ─────────────────────────────┐
01 (C): │ ││ ││ │
02 (C): │ ││ ││ │
03 (C): │ ││ ││ │
@ -13,7 +13,7 @@ expression: snapshot
07 (C): │ ││ ││ │
08 (C): │ ││ ││ │
09 (C): │ │└──────────────────────────────────────┘│ │
10 (C): │ │┌ Pane #3 ───┐┌ Pane #4 ──┐┌ Pane #5 ──┐│ │
10 (C): │ │┌ Pane #4 ───┐┌ Pane #5 ──┐┌ Pane #6 ──┐│ │
11 (C): │ ││ ││ ││ ││ │
12 (C): │ ││ ││ ││ ││ │
13 (C): │ ││ ││ ││ ││ │

View file

@ -1,19 +1,19 @@
---
source: zellij-server/src/tab/./unit/tab_integration_tests.rs
assertion_line: 2204
assertion_line: 3409
expression: snapshot
---
00 (C): ┌ Pane #1 ──────────────────────────────────────────────────┐┌ Pane #2 ─────────────────────────────────────────────────┐
00 (C): ┌ Pane #1 ──────────────────────────────────────────────────┐┌ Pane #3 ─────────────────────────────────────────────────┐
01 (C): │ ││ │
02 (C): │ ││ │
03 (C): │ ││ │
04 (C): │ │└──────────────────────────────────────────────────────────┘
05 (C): │ │┌ Pane #3 ─────────────────────────────────────────────────┐
05 (C): │ │┌ Pane #4 ─────────────────────────────────────────────────┐
06 (C): │ ││ │
07 (C): │ ││ │
08 (C): │ ││ │
09 (C): └───────────────────────────────────────────────────────────┘└──────────────────────────────────────────────────────────┘
10 (C): ┌ Pane #4 ──────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
10 (C): ┌ Pane #2 ──────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
11 (C): │ │
12 (C): │ │
13 (C): │ │

View file

@ -1,6 +1,6 @@
---
source: zellij-server/src/tab/./unit/tab_integration_tests.rs
assertion_line: 8192
assertion_line: 8199
expression: snapshot
---
00 (C): ┌ Pane #1 ──────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
@ -8,18 +8,18 @@ expression: snapshot
02 (C): │ │
03 (C): │ │
04 (C): │ │
05 (C): │ ┌ Pane #4 ──────────────────────────────────────── PIN [ ] ┐ │
05 (C): │ ┌ Pane #2 ──────────────────────────────────────── PIN [ ] ┐ │
06 (C): │ │ │ │
07 (C): │ │ ┐ │
07 (C): │ │ ┌ Pane #3 ──────────────────────────────────────── PIN [ ] ┐ │
08 (C): │ │ │ │ │
09 (C): │ │ │ │ ┐ │
09 (C): │ │ │ ┌ Pane #4 ──────────────────────────────────────── PIN [ ] ┐ │
10 (C): │ │ │ │ │ │
11 (C): │ │ │ │ │ │
12 (C): │ │ │ │ │ │
13 (C): │ │ │ │ │ │
14 (C): │ └──────────────────────────────────────────────────────────┘ │ │ │
14 (C): │ └─│ │ │ │
15 (C): │ │ │ │ │
16 (C): │ └──────────────────────────────────────────────────────────┘ │ │
16 (C): │ └─ │ │
17 (C): │ │ │ │
18 (C): │ └──────────────────────────────────────────────────────────┘ │
19 (C): └───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘

View file

@ -1,6 +1,6 @@
---
source: zellij-server/src/tab/./unit/tab_integration_tests.rs
assertion_line: 8266
assertion_line: 8267
expression: snapshot
---
00 (C): ┌ Pane #1 ──────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
@ -8,16 +8,16 @@ expression: snapshot
02 (C): │ │
03 (C): │ │
04 (C): │ │
05 (C): │ ┌ Pane #4 ──────────────────────────────────────── PIN [ ] ┐ │
05 (C): │ ┌ Pane #2 ──────────────────────────────────────── PIN [ ] ┐ │
06 (C): │ │ │ │
07 (C): │ │ ┐ │
07 (C): │ │ ┌ Pane #3 ──────────────────────────────────────── PIN [ ] ┐ │
08 (C): │ │ │ │ │
09 (C): │ │ ┌ Pane #2 ──────────────────────────────────────── PIN [ ] ┐ │
10 (C): │ │ │ │ │
11 (C): │ │ │ │ │
12 (C): │ │ │ │ │
13 (C): │ │ │ │ │
14 (C): │ └───│ │ │
09 (C): │ │ │ ┌ Pane #4 ──────────────────────────────────────── PIN [ ] ┐ │
10 (C): │ │ │ │ │
11 (C): │ │ │ │ │
12 (C): │ │ │ │ │
13 (C): │ │ │ │ │
14 (C): │ └─│ │ │
15 (C): │ │ │ │ │
16 (C): │ └─│ │ │
17 (C): │ │ │ │

View file

@ -1,9 +1,9 @@
---
source: zellij-server/src/tab/./unit/tab_integration_tests.rs
assertion_line: 5216
assertion_line: 7268
expression: snapshot
---
00 (C): ┌ Pane #2 ──────────────────────────────┐┌ Pane #1 ─────────────────────────────┐┌ Pane #3 ─────────────────────────────┐
00 (C): ┌ Pane #1 ──────────────────────────────┐┌ Pane #2 ─────────────────────────────┐┌ Pane #3 ─────────────────────────────┐
01 (C): │ ││ ││ │
02 (C): │ ││ ││ │
03 (C): │ ││ ││ │

View file

@ -1,9 +1,9 @@
---
source: zellij-server/src/tab/./unit/tab_integration_tests.rs
assertion_line: 5274
assertion_line: 7345
expression: snapshot
---
00 (C): ┌ Pane #1 ──────────────────────────────┐┌ Pane #3 ─────────────────────────────┐┌ Pane #2 ─────────────────────────────┐
00 (C): ┌ Pane #1 ──────────────────────────────┐┌ Pane #2 ─────────────────────────────┐┌ Pane #3 ─────────────────────────────┐
01 (C): │ ││ ││ │
02 (C): │ ││ ││ │
03 (C): │ ││ ││ │

View file

@ -2754,7 +2754,7 @@ fn close_suppressing_tiled_pane() {
.unwrap();
tab.handle_pty_bytes(1, Vec::from("\n\n\nI am the original pane".as_bytes()))
.unwrap();
tab.close_pane(new_pane_id, false, None);
tab.close_pane(new_pane_id, false);
tab.render(&mut output).unwrap();
let snapshot = take_snapshot(
output.serialize().unwrap().get(&client_id).unwrap(),
@ -2786,7 +2786,7 @@ fn close_suppressing_floating_pane() {
.unwrap();
tab.handle_pty_bytes(2, Vec::from("\n\n\nI am the original pane".as_bytes()))
.unwrap();
tab.close_pane(editor_pane_id, false, None);
tab.close_pane(editor_pane_id, false);
tab.render(&mut output).unwrap();
let snapshot = take_snapshot(
output.serialize().unwrap().get(&client_id).unwrap(),
@ -2814,7 +2814,7 @@ fn suppress_tiled_pane_float_it_and_close() {
tab.handle_pty_bytes(1, Vec::from("\n\n\nI am the original pane".as_bytes()))
.unwrap();
tab.toggle_pane_embed_or_floating(client_id).unwrap();
tab.close_pane(new_pane_id, false, None);
tab.close_pane(new_pane_id, false);
tab.render(&mut output).unwrap();
let snapshot = take_snapshot(
output.serialize().unwrap().get(&client_id).unwrap(),
@ -2847,7 +2847,7 @@ fn suppress_floating_pane_embed_it_and_close_it() {
tab.handle_pty_bytes(2, Vec::from("\n\n\nI am the original pane".as_bytes()))
.unwrap();
tab.toggle_pane_embed_or_floating(client_id).unwrap();
tab.close_pane(editor_pane_id, false, None);
tab.close_pane(editor_pane_id, false);
tab.render(&mut output).unwrap();
let snapshot = take_snapshot(
output.serialize().unwrap().get(&client_id).unwrap(),
@ -3757,7 +3757,7 @@ fn can_swap_tiled_layout_at_runtime() {
Some(client_id),
)
.unwrap();
tab.next_swap_layout(Some(client_id), false).unwrap();
tab.next_swap_layout().unwrap();
tab.render(&mut output).unwrap();
let snapshot = take_snapshot(
output.serialize().unwrap().get(&client_id).unwrap(),
@ -3830,7 +3830,7 @@ fn can_swap_floating_layout_at_runtime() {
Some(client_id),
)
.unwrap();
tab.next_swap_layout(Some(client_id), false).unwrap();
tab.next_swap_layout().unwrap();
tab.render(&mut output).unwrap();
let snapshot = take_snapshot(
output.serialize().unwrap().get(&client_id).unwrap(),
@ -3889,10 +3889,10 @@ fn swapping_layouts_after_resize_snaps_to_current_layout() {
Some(client_id),
)
.unwrap();
tab.next_swap_layout(Some(client_id), false).unwrap();
tab.next_swap_layout().unwrap();
tab.resize(client_id, ResizeStrategy::new(Resize::Increase, None))
.unwrap();
tab.next_swap_layout(Some(client_id), false).unwrap();
tab.next_swap_layout().unwrap();
tab.render(&mut output).unwrap();
let snapshot = take_snapshot(
output.serialize().unwrap().get(&client_id).unwrap(),
@ -4502,7 +4502,7 @@ fn move_focus_down_into_stacked_panes() {
tab {
pane
pane split_direction="vertical" {
pane focus=true
pane
pane stacked=true { children; }
}
pane
@ -4620,7 +4620,7 @@ fn close_main_stacked_pane() {
Some(client_id),
)
.unwrap();
tab.close_pane(new_pane_id_2, false, None);
tab.close_pane(new_pane_id_2, false);
tab.render(&mut output).unwrap();
let snapshot = take_snapshot(
output.serialize().unwrap().get(&client_id).unwrap(),
@ -4644,7 +4644,7 @@ fn close_main_stacked_pane_in_mid_stack() {
swap_tiled_layout {
tab {
pane split_direction="vertical" {
pane focus=true
pane
pane stacked=true { children; }
}
}
@ -4720,7 +4720,7 @@ fn close_main_stacked_pane_in_mid_stack() {
tab.move_focus_right(client_id);
tab.move_focus_up(client_id);
tab.move_focus_up(client_id);
tab.close_pane(new_pane_id_3, false, None);
tab.close_pane(new_pane_id_3, false);
tab.render(&mut output).unwrap();
let snapshot = take_snapshot(
output.serialize().unwrap().get(&client_id).unwrap(),
@ -4744,7 +4744,7 @@ fn close_one_liner_stacked_pane_below_main_pane() {
swap_tiled_layout {
tab {
pane split_direction="vertical" {
pane focus=true
pane
pane stacked=true { children; }
}
}
@ -4821,7 +4821,7 @@ fn close_one_liner_stacked_pane_below_main_pane() {
tab.move_focus_right(client_id);
tab.move_focus_up(client_id);
tab.move_focus_up(client_id);
tab.close_pane(new_pane_id_2, false, None);
tab.close_pane(new_pane_id_2, false);
tab.render(&mut output).unwrap();
let snapshot = take_snapshot(
output.serialize().unwrap().get(&client_id).unwrap(),
@ -4845,7 +4845,7 @@ fn close_one_liner_stacked_pane_above_main_pane() {
swap_tiled_layout {
tab {
pane split_direction="vertical" {
pane focus=true
pane
pane stacked=true { children; }
}
}
@ -4921,7 +4921,7 @@ fn close_one_liner_stacked_pane_above_main_pane() {
tab.move_focus_right(client_id);
tab.move_focus_up(client_id);
tab.move_focus_up(client_id);
tab.close_pane(new_pane_id_1, false, None);
tab.close_pane(new_pane_id_2, false);
tab.render(&mut output).unwrap();
let snapshot = take_snapshot(
output.serialize().unwrap().get(&client_id).unwrap(),
@ -5226,7 +5226,6 @@ fn can_increase_size_of_main_pane_in_stack_non_directionally() {
Some(client_id),
)
.unwrap();
let _ = tab.move_focus_up(client_id);
let _ = tab.move_focus_right(client_id);
tab.resize(client_id, ResizeStrategy::new(Resize::Increase, None))
.unwrap();
@ -5534,7 +5533,6 @@ fn can_increase_size_into_pane_stack_non_directionally() {
Some(client_id),
)
.unwrap();
let _ = tab.move_focus_up(client_id);
tab.resize(client_id, ResizeStrategy::new(Resize::Increase, None))
.unwrap();
tab.render(&mut output).unwrap();
@ -6069,7 +6067,7 @@ fn close_stacked_pane_with_previously_focused_other_pane() {
swap_tiled_layout {
tab {
pane split_direction="vertical" {
pane focus=true
pane
pane stacked=true { children; }
}
pane
@ -6147,7 +6145,7 @@ fn close_stacked_pane_with_previously_focused_other_pane() {
.unwrap();
tab.handle_left_click(&Position::new(1, 71), client_id)
.unwrap();
tab.close_pane(PaneId::Terminal(4), false, None);
tab.close_pane(PaneId::Terminal(4), false);
tab.render(&mut output).unwrap();
let (snapshot, cursor_coordinates) = take_snapshot_and_cursor_position(
output.serialize().unwrap().get(&client_id).unwrap(),
@ -6250,7 +6248,7 @@ fn close_pane_near_stacked_panes() {
Some(client_id),
)
.unwrap();
tab.close_pane(PaneId::Terminal(6), false, None);
tab.close_pane(PaneId::Terminal(6), false);
tab.render(&mut output).unwrap();
let (snapshot, cursor_coordinates) = take_snapshot_and_cursor_position(
output.serialize().unwrap().get(&client_id).unwrap(),
@ -6518,8 +6516,10 @@ fn layout_with_plugins_and_commands_swaped_properly() {
let mut command_1 = RunCommand::default();
command_1.command = PathBuf::from("command1");
command_1.hold_on_close = true;
let mut command_2 = RunCommand::default();
command_2.command = PathBuf::from("command2");
command_2.hold_on_close = true;
let new_terminal_ids = vec![(1, Some(command_1)), (2, None), (3, Some(command_2))];
let new_floating_terminal_ids = vec![];
let mut new_plugin_ids = HashMap::new();
@ -6551,7 +6551,7 @@ fn layout_with_plugins_and_commands_swaped_properly() {
);
let _ = tab.handle_plugin_bytes(1, 1, "I am a tab bar".as_bytes().to_vec());
let _ = tab.handle_plugin_bytes(2, 1, "I am a\n\rstatus bar".as_bytes().to_vec());
tab.next_swap_layout(Some(client_id), false).unwrap();
tab.next_swap_layout().unwrap();
tab.render(&mut output).unwrap();
let snapshot = take_snapshot(
output.serialize().unwrap().get(&client_id).unwrap(),
@ -6647,8 +6647,8 @@ fn base_layout_is_included_in_swap_layouts() {
);
let _ = tab.handle_plugin_bytes(1, 1, "I am a tab bar".as_bytes().to_vec());
let _ = tab.handle_plugin_bytes(2, 1, "I am a\n\rstatus bar".as_bytes().to_vec());
tab.next_swap_layout(Some(client_id), false).unwrap();
tab.previous_swap_layout(Some(client_id)).unwrap(); // move back to the base layout
tab.next_swap_layout().unwrap();
tab.previous_swap_layout().unwrap(); // move back to the base layout
tab.render(&mut output).unwrap();
let snapshot = take_snapshot(
output.serialize().unwrap().get(&client_id).unwrap(),
@ -6740,7 +6740,7 @@ fn swap_layouts_including_command_panes_absent_from_existing_layout() {
);
let _ = tab.handle_plugin_bytes(1, 1, "I am a tab bar".as_bytes().to_vec());
let _ = tab.handle_plugin_bytes(2, 1, "I am a\n\rstatus bar".as_bytes().to_vec());
tab.next_swap_layout(Some(client_id), false).unwrap();
tab.next_swap_layout().unwrap();
tab.render(&mut output).unwrap();
let snapshot = take_snapshot(
output.serialize().unwrap().get(&client_id).unwrap(),
@ -6836,7 +6836,7 @@ fn swap_layouts_not_including_command_panes_present_in_existing_layout() {
);
let _ = tab.handle_plugin_bytes(1, 1, "I am a tab bar".as_bytes().to_vec());
let _ = tab.handle_plugin_bytes(2, 1, "I am a\n\rstatus bar".as_bytes().to_vec());
tab.next_swap_layout(Some(client_id), false).unwrap();
tab.next_swap_layout().unwrap();
tab.render(&mut output).unwrap();
let snapshot = take_snapshot(
output.serialize().unwrap().get(&client_id).unwrap(),
@ -6914,7 +6914,7 @@ fn swap_layouts_including_plugin_panes_absent_from_existing_layout() {
)),
true,
);
tab.next_swap_layout(Some(client_id), false).unwrap();
tab.next_swap_layout().unwrap();
tab.render(&mut output).unwrap();
let snapshot = take_snapshot(
output.serialize().unwrap().get(&client_id).unwrap(),
@ -7006,7 +7006,7 @@ fn swap_layouts_not_including_plugin_panes_present_in_existing_layout() {
);
let _ = tab.handle_plugin_bytes(1, 1, "I am a tab bar".as_bytes().to_vec());
let _ = tab.handle_plugin_bytes(2, 1, "I am a\n\rstatus bar".as_bytes().to_vec());
tab.next_swap_layout(Some(client_id), false).unwrap();
tab.next_swap_layout().unwrap();
tab.render(&mut output).unwrap();
let snapshot = take_snapshot(
output.serialize().unwrap().get(&client_id).unwrap(),
@ -7080,9 +7080,9 @@ fn new_pane_in_auto_layout() {
(62, 11),
(62, 15),
(62, 16),
(1, 11),
(1, 15),
(1, 16),
(62, 16),
(62, 16),
(62, 16),
];
for i in 0..7 {
let new_pane_id = i + 2;
@ -7175,7 +7175,7 @@ fn when_swapping_tiled_layouts_in_a_damaged_state_layout_and_pane_focus_are_unch
ResizeStrategy::new(Resize::Increase, Some(Direction::Down)),
)
.unwrap();
tab.next_swap_layout(Some(client_id), false).unwrap();
tab.next_swap_layout().unwrap();
tab.render(&mut output).unwrap();
let (snapshot, cursor_coordinates) = take_snapshot_and_cursor_position(
@ -7249,7 +7249,7 @@ fn when_swapping_tiled_layouts_in_an_undamaged_state_pane_focuses_on_focused_nod
true,
);
tab.move_focus_down(client_id);
tab.next_swap_layout(Some(client_id), true).unwrap();
tab.next_swap_layout().unwrap();
tab.render(&mut output).unwrap();
let (snapshot, cursor_coordinates) = take_snapshot_and_cursor_position(
@ -7324,7 +7324,8 @@ fn when_swapping_tiled_layouts_in_an_undamaged_state_with_no_focus_node_pane_foc
true,
);
tab.move_focus_down(client_id);
tab.next_swap_layout(Some(client_id), true).unwrap();
tab.move_focus_down(client_id);
tab.next_swap_layout().unwrap();
tab.render(&mut output).unwrap();
let (snapshot, cursor_coordinates) = take_snapshot_and_cursor_position(
@ -7399,7 +7400,7 @@ fn when_closing_a_pane_in_auto_layout_the_focus_goes_to_last_focused_pane() {
);
let _ = tab.move_focus_down(client_id);
let _ = tab.move_focus_down(client_id);
tab.close_pane(PaneId::Terminal(3), false, Some(client_id));
tab.close_pane(PaneId::Terminal(3), false);
tab.render(&mut output).unwrap();
let (snapshot, cursor_coordinates) = take_snapshot_and_cursor_position(
@ -7498,7 +7499,7 @@ fn floating_layout_with_plugins_and_commands_swaped_properly() {
);
let _ = tab.handle_plugin_bytes(1, 1, "I am a tab bar".as_bytes().to_vec());
let _ = tab.handle_plugin_bytes(2, 1, "I am a\n\rstatus bar".as_bytes().to_vec());
tab.next_swap_layout(Some(client_id), false).unwrap();
tab.next_swap_layout().unwrap();
tab.render(&mut output).unwrap();
let snapshot = take_snapshot(
output.serialize().unwrap().get(&client_id).unwrap(),
@ -7592,8 +7593,8 @@ fn base_floating_layout_is_included_in_swap_layouts() {
);
let _ = tab.handle_plugin_bytes(1, 1, "I am a tab bar".as_bytes().to_vec());
let _ = tab.handle_plugin_bytes(2, 1, "I am a\n\rstatus bar".as_bytes().to_vec());
tab.next_swap_layout(Some(client_id), false).unwrap();
tab.previous_swap_layout(Some(client_id)).unwrap(); // move back to the base layout
tab.next_swap_layout().unwrap();
tab.previous_swap_layout().unwrap(); // move back to the base layout
tab.render(&mut output).unwrap();
let snapshot = take_snapshot(
output.serialize().unwrap().get(&client_id).unwrap(),
@ -7685,7 +7686,7 @@ fn swap_floating_layouts_including_command_panes_absent_from_existing_layout() {
);
let _ = tab.handle_plugin_bytes(1, 1, "I am a tab bar".as_bytes().to_vec());
let _ = tab.handle_plugin_bytes(2, 1, "I am a\n\rstatus bar".as_bytes().to_vec());
tab.next_swap_layout(Some(client_id), false).unwrap();
tab.next_swap_layout().unwrap();
tab.render(&mut output).unwrap();
let snapshot = take_snapshot(
output.serialize().unwrap().get(&client_id).unwrap(),
@ -7781,7 +7782,7 @@ fn swap_floating_layouts_not_including_command_panes_present_in_existing_layout(
);
let _ = tab.handle_plugin_bytes(1, 1, "I am a tab bar".as_bytes().to_vec());
let _ = tab.handle_plugin_bytes(2, 1, "I am a\n\rstatus bar".as_bytes().to_vec());
tab.next_swap_layout(Some(client_id), false).unwrap();
tab.next_swap_layout().unwrap();
tab.render(&mut output).unwrap();
let snapshot = take_snapshot(
output.serialize().unwrap().get(&client_id).unwrap(),
@ -7852,7 +7853,7 @@ fn swap_floating_layouts_including_plugin_panes_absent_from_existing_layout() {
)),
true,
);
tab.next_swap_layout(Some(client_id), false).unwrap();
tab.next_swap_layout().unwrap();
tab.render(&mut output).unwrap();
let snapshot = take_snapshot(
output.serialize().unwrap().get(&client_id).unwrap(),
@ -7940,7 +7941,7 @@ fn swap_floating_layouts_not_including_plugin_panes_present_in_existing_layout()
);
let _ = tab.handle_plugin_bytes(1, 1, "I am a tab bar".as_bytes().to_vec());
let _ = tab.handle_plugin_bytes(2, 1, "I am a\n\rstatus bar".as_bytes().to_vec());
tab.next_swap_layout(Some(client_id), false).unwrap();
tab.next_swap_layout().unwrap();
tab.render(&mut output).unwrap();
let snapshot = take_snapshot(
output.serialize().unwrap().get(&client_id).unwrap(),
@ -7974,9 +7975,9 @@ fn new_floating_pane_in_auto_layout() {
pane { x "50%"; y "25%"; width "45%"; }
}
floating_panes max_panes=3 {
pane focus=true { y "55%"; width "45%"; height "45%"; }
pane { x "1%"; y "1%"; width "45%"; }
pane { x "50%"; y "1%"; width "45%"; }
pane { y "55%"; width "45%"; height "45%"; }
}
}
}
@ -8101,7 +8102,7 @@ fn when_swapping_floating_layouts_in_a_damaged_state_layout_and_pane_focus_are_u
ResizeStrategy::new(Resize::Increase, Some(Direction::Down)),
)
.unwrap();
tab.next_swap_layout(Some(client_id), true).unwrap();
tab.next_swap_layout().unwrap();
tab.render(&mut output).unwrap();
let (snapshot, cursor_coordinates) = take_snapshot_and_cursor_position(
@ -8140,7 +8141,7 @@ fn when_swapping_floating_layouts_in_an_undamaged_state_pane_focuses_on_focused_
layout {
swap_floating_layout {
floating_panes {
pane focus=true
pane
pane
pane
}
@ -8174,7 +8175,7 @@ fn when_swapping_floating_layouts_in_an_undamaged_state_pane_focuses_on_focused_
)),
true,
);
tab.next_swap_layout(Some(client_id), true).unwrap();
tab.next_swap_layout().unwrap();
tab.render(&mut output).unwrap();
let (snapshot, cursor_coordinates) = take_snapshot_and_cursor_position(
@ -8185,7 +8186,7 @@ fn when_swapping_floating_layouts_in_an_undamaged_state_pane_focuses_on_focused_
);
assert_eq!(
cursor_coordinates,
Some((31, 6)),
Some((35, 10)),
"cursor coordinates moved to the new pane",
);
@ -8204,7 +8205,7 @@ fn when_swapping_floating_layouts_in_an_undamaged_state_with_no_focus_node_pane_
let base_layout = r#"
layout {
floating_panes {
pane focus=true
pane
pane
pane
}
@ -8248,7 +8249,7 @@ fn when_swapping_floating_layouts_in_an_undamaged_state_with_no_focus_node_pane_
)),
true,
);
tab.next_swap_layout(Some(client_id), true).unwrap();
tab.next_swap_layout().unwrap();
tab.render(&mut output).unwrap();
let (snapshot, cursor_coordinates) = take_snapshot_and_cursor_position(
@ -8323,7 +8324,7 @@ fn when_closing_a_floating_pane_in_auto_layout_the_focus_goes_to_last_focused_pa
);
tab.move_focus_up(client_id);
tab.move_focus_up(client_id);
tab.close_pane(PaneId::Terminal(1), false, Some(client_id));
tab.close_pane(PaneId::Terminal(1), false);
tab.render(&mut output).unwrap();
let (snapshot, cursor_coordinates) = take_snapshot_and_cursor_position(

View file

@ -14429,7 +14429,7 @@ fn correctly_resize_frameless_panes_on_pane_close() {
tab.new_pane(PaneId::Terminal(2), None, None, None, None, false, Some(1))
.unwrap();
tab.close_pane(PaneId::Terminal(2), true, None);
tab.close_pane(PaneId::Terminal(2), true);
// the size should be the same after adding and then removing a pane
let pane = tab.tiled_panes.panes.get(&PaneId::Terminal(1)).unwrap();

View file

@ -2324,7 +2324,18 @@ pub fn send_cli_new_pane_action_with_command_and_cwd() {
send_cli_action_to_server(&session_metadata, cli_new_pane_action, client_id);
std::thread::sleep(std::time::Duration::from_millis(100)); // give time for actions to be
mock_screen.teardown(vec![pty_thread, screen_thread]);
assert_snapshot!(format!("{:?}", *received_pty_instructions.lock().unwrap()));
let new_pane_instruction = received_pty_instructions
.lock()
.unwrap()
.iter()
.find(|instruction| match instruction {
PtyInstruction::SpawnTerminalVertically(..) => true,
_ => false,
})
.cloned();
assert_snapshot!(format!("{:?}", new_pane_instruction));
}
#[test]

View file

@ -1,9 +1,9 @@
---
source: zellij-server/src/./unit/screen_tests.rs
assertion_line: 3079
assertion_line: 3636
expression: "format!(\"{}\", snapshot)"
---
00 (C): ┌ pane_to_stay ────────────────────────┐┌ pane_to_break_free ──────────────────┐
00 (C): ┌ pane_to_break_free ──────────────────┐┌ pane_to_stay ────────────────────────┐
01 (C): │ ││ │
02 (C): │ ││ │
03 (C): │ ││ │

View file

@ -1,9 +1,9 @@
---
source: zellij-server/src/./unit/screen_tests.rs
assertion_line: 3032
assertion_line: 3587
expression: "format!(\"{}\", snapshot)"
---
00 (C): ┌ pane_to_stay ────────────────────────┐┌ pane_to_break_free ──────────────────┐
00 (C): ┌ pane_to_break_free ──────────────────┐┌ pane_to_stay ────────────────────────┐
01 (C): │ ││ │
02 (C): │ ││ │
03 (C): │ ││ │

View file

@ -1,6 +1,6 @@
---
source: zellij-server/src/./unit/screen_tests.rs
assertion_line: 2306
expression: "format!(\"{:?}\", * received_pty_instructions.lock().unwrap())"
assertion_line: 2339
expression: "format!(\"{:?}\", new_pane_instruction)"
---
[SpawnTerminalVertically(Some(RunCommand(RunCommand { command: "htop", args: [], cwd: Some("/some/folder"), hold_on_close: true, hold_on_start: false, originating_plugin: None })), None, 10), UpdateActivePane(Some(Terminal(0)), 1), UpdateActivePane(Some(Terminal(0)), 1), Exit]
Some(SpawnTerminalVertically(Some(RunCommand(RunCommand { command: "htop", args: [], cwd: Some("/some/folder"), hold_on_close: true, hold_on_start: false, originating_plugin: None })), None, 10))

View file

@ -1,9 +1,9 @@
---
source: zellij-server/src/./unit/screen_tests.rs
assertion_line: 2131
assertion_line: 2569
expression: "format!(\"{}\", snapshot)"
---
00 (C): ┌ Pane #2 ─────────────────────────────┐┌ Pane #1 ─────────────────────────────┐
00 (C): ┌ Pane #1 ─────────────────────────────┐┌ Pane #2 ─────────────────────────────┐
01 (C): │ ││ │
02 (C): │ ││ │
03 (C): │ ││ │

View file

@ -78,7 +78,7 @@ swap_floating_layout name="enlarged" {
pane { x "5%"; y 7; width "90%"; height "90%"; }
pane { x "5%"; y 8; width "90%"; height "90%"; }
pane { x "5%"; y 9; width "90%"; height "90%"; }
pane focus=true { x 10; y 10; width "90%"; height "90%"; }
pane { x 10; y 10; width "90%"; height "90%"; }
}
}
@ -91,13 +91,13 @@ swap_floating_layout name="spread" {
pane { x "50%"; y "25%"; width "45%"; }
}
floating_panes max_panes=3 {
pane focus=true { y "55%"; width "45%"; height "45%"; }
pane { y "55%"; width "45%"; height "45%"; }
pane { x "1%"; y "1%"; width "45%"; }
pane { x "50%"; y "1%"; width "45%"; }
}
floating_panes max_panes=4 {
pane { x "1%"; y "55%"; width "45%"; height "45%"; }
pane focus=true { x "50%"; y "55%"; width "45%"; height "45%"; }
pane { x "50%"; y "55%"; width "45%"; height "45%"; }
pane { x "1%"; y "1%"; width "45%"; height "45%"; }
pane { x "50%"; y "1%"; width "45%"; height "45%"; }
}

View file

@ -71,7 +71,7 @@ swap_floating_layout name="enlarged" {
pane { x "5%"; y 7; width "90%"; height "90%"; }
pane { x "5%"; y 8; width "90%"; height "90%"; }
pane { x "5%"; y 9; width "90%"; height "90%"; }
pane focus=true { x 10; y 10; width "90%"; height "90%"; }
pane { x 10; y 10; width "90%"; height "90%"; }
}
}
@ -84,13 +84,13 @@ swap_floating_layout name="spread" {
pane { x "50%"; y "25%"; width "45%"; }
}
floating_panes max_panes=3 {
pane focus=true { y "55%"; width "45%"; height "45%"; }
pane { y "55%"; width "45%"; height "45%"; }
pane { x "1%"; y "1%"; width "45%"; }
pane { x "50%"; y "1%"; width "45%"; }
}
floating_panes max_panes=4 {
pane { x "1%"; y "55%"; width "45%"; height "45%"; }
pane focus=true { x "50%"; y "55%"; width "45%"; height "45%"; }
pane { x "50%"; y "55%"; width "45%"; height "45%"; }
pane { x "1%"; y "1%"; width "45%"; height "45%"; }
pane { x "50%"; y "1%"; width "45%"; height "45%"; }
}

View file

@ -74,7 +74,7 @@ swap_floating_layout name="enlarged" {
pane { x "5%"; y 7; width "90%"; height "90%"; }
pane { x "5%"; y 8; width "90%"; height "90%"; }
pane { x "5%"; y 9; width "90%"; height "90%"; }
pane focus=true { x 10; y 10; width "90%"; height "90%"; }
pane { x 10; y 10; width "90%"; height "90%"; }
}
}
@ -87,13 +87,13 @@ swap_floating_layout name="spread" {
pane { x "50%"; y "25%"; width "45%"; }
}
floating_panes max_panes=3 {
pane focus=true { y "55%"; width "45%"; height "45%"; }
pane { y "55%"; width "45%"; height "45%"; }
pane { x "1%"; y "1%"; width "45%"; }
pane { x "50%"; y "1%"; width "45%"; }
}
floating_panes max_panes=4 {
pane { x "1%"; y "55%"; width "45%"; height "45%"; }
pane focus=true { x "50%"; y "55%"; width "45%"; height "45%"; }
pane { x "50%"; y "55%"; width "45%"; height "45%"; }
pane { x "1%"; y "1%"; width "45%"; height "45%"; }
pane { x "50%"; y "1%"; width "45%"; height "45%"; }
}

View file

@ -743,6 +743,7 @@ pub struct FloatingPaneLayout {
pub focus: Option<bool>,
pub already_running: bool,
pub pane_initial_contents: Option<String>,
pub logical_position: Option<usize>,
}
impl FloatingPaneLayout {
@ -758,6 +759,7 @@ impl FloatingPaneLayout {
focus: None,
already_running: false,
pane_initial_contents: None,
logical_position: None,
}
}
pub fn add_cwd_to_layout(&mut self, cwd: &PathBuf) {
@ -877,6 +879,7 @@ impl TiledPaneLayout {
space: &PaneGeom,
max_panes: Option<usize>,
ignore_percent_split_sizes: bool,
focus_layout_if_not_focused: bool,
) -> Result<Vec<(TiledPaneLayout, PaneGeom)>, &'static str> {
let layouts = match max_panes {
Some(max_panes) => {
@ -889,7 +892,7 @@ impl TiledPaneLayout {
// because we really should support that
let children_count = (max_panes - pane_count_in_layout) + 1;
let mut extra_children = vec![TiledPaneLayout::default(); children_count];
if !layout_to_split.has_focused_node() {
if !layout_to_split.has_focused_node() && focus_layout_if_not_focused {
if let Some(last_child) = extra_children.last_mut() {
last_child.focus = Some(true);
}
@ -898,7 +901,7 @@ impl TiledPaneLayout {
} else {
layout_to_split.truncate(max_panes);
}
if !layout_to_split.has_focused_node() {
if !layout_to_split.has_focused_node() && focus_layout_if_not_focused {
layout_to_split.focus_deepest_pane();
}
@ -1700,6 +1703,7 @@ fn split_space(
rows: inherited_dimension,
is_stacked: layout.children_are_stacked,
is_pinned: false,
logical_position: None,
},
SplitDirection::Horizontal => PaneGeom {
x: space_to_split.x,
@ -1708,6 +1712,7 @@ fn split_space(
rows: split_dimension,
is_stacked: layout.children_are_stacked,
is_pinned: false,
logical_position: None,
},
};
split_geom.push(geom);
@ -1720,6 +1725,7 @@ fn split_space(
layout.children_split_direction,
);
let mut pane_positions = Vec::new();
let mut pane_positions_with_children = Vec::new();
for (i, part) in layout.children.iter().enumerate() {
let part_position_and_size = split_geom.get(i).unwrap();
if !part.children.is_empty() {
@ -1729,12 +1735,18 @@ fn split_space(
total_space_to_split,
ignore_percent_split_sizes,
)?;
pane_positions.append(&mut part_positions);
// add the only first child to pane_positions only adding the others after all the
// childfree panes have been added so that the returned vec will be sorted breadth-first
if !part_positions.is_empty() {
pane_positions.push(part_positions.remove(0));
}
pane_positions_with_children.append(&mut part_positions);
} else {
let part = part.clone();
pane_positions.push((part, *part_position_and_size));
}
}
pane_positions.append(&mut pane_positions_with_children);
if pane_positions.is_empty() {
let layout = layout.clone();
pane_positions.push((layout, space_to_split.clone()));

View file

@ -52,6 +52,7 @@ Layout {
focus: None,
already_running: false,
pane_initial_contents: None,
logical_position: None,
},
],
),
@ -102,6 +103,7 @@ Layout {
focus: None,
already_running: false,
pane_initial_contents: None,
logical_position: None,
},
FloatingPaneLayout {
name: None,
@ -114,6 +116,7 @@ Layout {
focus: None,
already_running: false,
pane_initial_contents: None,
logical_position: None,
},
],
),

View file

@ -18,12 +18,12 @@ pub struct PaneGeom {
pub cols: Dimension,
pub is_stacked: bool,
pub is_pinned: bool, // only relevant to floating panes
pub logical_position: Option<usize>, // relevant when placing this pane in a layout
}
impl PartialEq for PaneGeom {
fn eq(&self, other: &Self) -> bool {
// compare all except is_pinned
// TODO: add is_stacked?
self.x == other.x
&& self.y == other.y
&& self.rows == other.rows

View file

@ -787,6 +787,7 @@ fn get_floating_panes_layout_from_panegeoms(
focus: Some(m.is_focused),
already_running: false,
pane_initial_contents: m.pane_contents.clone(),
logical_position: None,
}
})
.collect()
@ -1285,6 +1286,7 @@ mod tests {
cols: Dimension::fixed(10),
is_stacked: false,
is_pinned: false,
logical_position: None,
},
..Default::default()
},
@ -1297,6 +1299,7 @@ mod tests {
cols: Dimension::fixed(10),
is_stacked: false,
is_pinned: false,
logical_position: None,
},
..Default::default()
},
@ -1313,6 +1316,7 @@ mod tests {
cols: Dimension::fixed(10),
is_stacked: false,
is_pinned: false,
logical_position: None,
},
..Default::default()
},
@ -1328,6 +1332,7 @@ mod tests {
cols: Dimension::fixed(10),
is_stacked: false,
is_pinned: false,
logical_position: None,
},
..Default::default()
},
@ -1348,6 +1353,7 @@ mod tests {
cols: Dimension::fixed(10),
is_stacked: false,
is_pinned: false,
logical_position: None,
},
..Default::default()
},
@ -1362,6 +1368,7 @@ mod tests {
cols: Dimension::fixed(10),
is_stacked: false,
is_pinned: false,
logical_position: None,
},
..Default::default()
},
@ -1378,6 +1385,7 @@ mod tests {
cols: Dimension::fixed(10),
is_stacked: false,
is_pinned: false,
logical_position: None,
},
..Default::default()
},
@ -1390,6 +1398,7 @@ mod tests {
cols: Dimension::fixed(10),
is_stacked: false,
is_pinned: false,
logical_position: None,
},
..Default::default()
},
@ -1404,6 +1413,7 @@ mod tests {
cols: Dimension::fixed(10),
is_stacked: false,
is_pinned: false,
logical_position: None,
},
..Default::default()
},
@ -1434,6 +1444,7 @@ mod tests {
cols: Dimension::fixed(10),
is_stacked: false,
is_pinned: false,
logical_position: None,
},
..Default::default()
},
@ -1446,6 +1457,7 @@ mod tests {
cols: Dimension::fixed(10),
is_stacked: false,
is_pinned: false,
logical_position: None,
},
..Default::default()
},
@ -1462,6 +1474,7 @@ mod tests {
cols: Dimension::fixed(10),
is_stacked: false,
is_pinned: false,
logical_position: None,
},
..Default::default()
},
@ -1477,6 +1490,7 @@ mod tests {
cols: Dimension::fixed(10),
is_stacked: false,
is_pinned: false,
logical_position: None,
},
..Default::default()
},
@ -1497,6 +1511,7 @@ mod tests {
cols: Dimension::fixed(10),
is_stacked: false,
is_pinned: false,
logical_position: None,
},
..Default::default()
},
@ -1511,6 +1526,7 @@ mod tests {
cols: Dimension::fixed(10),
is_stacked: false,
is_pinned: false,
logical_position: None,
},
..Default::default()
},
@ -1527,6 +1543,7 @@ mod tests {
cols: Dimension::fixed(10),
is_stacked: false,
is_pinned: false,
logical_position: None,
},
..Default::default()
},
@ -1541,6 +1558,7 @@ mod tests {
cols: Dimension::fixed(10),
is_stacked: false,
is_pinned: false,
logical_position: None,
},
..Default::default()
},
@ -1555,6 +1573,7 @@ mod tests {
cols: Dimension::fixed(10),
is_stacked: false,
is_pinned: false,
logical_position: None,
},
..Default::default()
},
@ -1583,6 +1602,7 @@ mod tests {
cols: Dimension::fixed(10),
is_stacked: true,
is_pinned: false,
logical_position: None,
},
..Default::default()
},
@ -1594,6 +1614,7 @@ mod tests {
cols: Dimension::fixed(10),
is_stacked: true,
is_pinned: false,
logical_position: None,
},
..Default::default()
},
@ -1605,6 +1626,7 @@ mod tests {
cols: Dimension::fixed(10),
is_stacked: true,
is_pinned: false,
logical_position: None,
},
..Default::default()
},
@ -1629,6 +1651,7 @@ mod tests {
cols: Dimension::percent(100.0),
is_stacked: false,
is_pinned: false,
logical_position: None,
},
..Default::default()
}],
@ -1644,6 +1667,7 @@ mod tests {
cols: Dimension::fixed(10),
is_stacked: false,
is_pinned: false,
logical_position: None,
},
..Default::default()
},
@ -1655,6 +1679,7 @@ mod tests {
cols: Dimension::fixed(10),
is_stacked: false,
is_pinned: false,
logical_position: None,
},
..Default::default()
},
@ -1787,6 +1812,7 @@ mod tests {
cols: get_dim(&data["cols"]),
is_stacked: data["is_stacked"].to_string().parse().unwrap(),
is_pinned: false,
logical_position: None,
}
}

View file

@ -1681,6 +1681,7 @@ Layout {
focus: None,
already_running: false,
pane_initial_contents: None,
logical_position: None,
},
FloatingPaneLayout {
name: None,
@ -1709,6 +1710,7 @@ Layout {
focus: None,
already_running: false,
pane_initial_contents: None,
logical_position: None,
},
FloatingPaneLayout {
name: None,
@ -1737,6 +1739,7 @@ Layout {
focus: None,
already_running: false,
pane_initial_contents: None,
logical_position: None,
},
FloatingPaneLayout {
name: None,
@ -1765,6 +1768,7 @@ Layout {
focus: None,
already_running: false,
pane_initial_contents: None,
logical_position: None,
},
FloatingPaneLayout {
name: None,
@ -1793,6 +1797,7 @@ Layout {
focus: None,
already_running: false,
pane_initial_contents: None,
logical_position: None,
},
FloatingPaneLayout {
name: None,
@ -1821,6 +1826,7 @@ Layout {
focus: None,
already_running: false,
pane_initial_contents: None,
logical_position: None,
},
FloatingPaneLayout {
name: None,
@ -1849,6 +1855,7 @@ Layout {
focus: None,
already_running: false,
pane_initial_contents: None,
logical_position: None,
},
FloatingPaneLayout {
name: None,
@ -1877,6 +1884,7 @@ Layout {
focus: None,
already_running: false,
pane_initial_contents: None,
logical_position: None,
},
FloatingPaneLayout {
name: None,
@ -1905,6 +1913,7 @@ Layout {
focus: None,
already_running: false,
pane_initial_contents: None,
logical_position: None,
},
FloatingPaneLayout {
name: None,
@ -1930,11 +1939,10 @@ Layout {
),
pinned: None,
run: None,
focus: Some(
true,
),
focus: None,
already_running: false,
pane_initial_contents: None,
logical_position: None,
},
],
},
@ -1966,6 +1974,7 @@ Layout {
focus: None,
already_running: false,
pane_initial_contents: None,
logical_position: None,
},
],
MaxPanes(
@ -1994,6 +2003,7 @@ Layout {
focus: None,
already_running: false,
pane_initial_contents: None,
logical_position: None,
},
FloatingPaneLayout {
name: None,
@ -2018,6 +2028,7 @@ Layout {
focus: None,
already_running: false,
pane_initial_contents: None,
logical_position: None,
},
],
MaxPanes(
@ -2043,11 +2054,10 @@ Layout {
),
pinned: None,
run: None,
focus: Some(
true,
),
focus: None,
already_running: false,
pane_initial_contents: None,
logical_position: None,
},
FloatingPaneLayout {
name: None,
@ -2072,6 +2082,7 @@ Layout {
focus: None,
already_running: false,
pane_initial_contents: None,
logical_position: None,
},
FloatingPaneLayout {
name: None,
@ -2096,6 +2107,7 @@ Layout {
focus: None,
already_running: false,
pane_initial_contents: None,
logical_position: None,
},
],
MaxPanes(
@ -2128,6 +2140,7 @@ Layout {
focus: None,
already_running: false,
pane_initial_contents: None,
logical_position: None,
},
FloatingPaneLayout {
name: None,
@ -2153,11 +2166,10 @@ Layout {
),
pinned: None,
run: None,
focus: Some(
true,
),
focus: None,
already_running: false,
pane_initial_contents: None,
logical_position: None,
},
FloatingPaneLayout {
name: None,
@ -2186,6 +2198,7 @@ Layout {
focus: None,
already_running: false,
pane_initial_contents: None,
logical_position: None,
},
FloatingPaneLayout {
name: None,
@ -2214,6 +2227,7 @@ Layout {
focus: None,
already_running: false,
pane_initial_contents: None,
logical_position: None,
},
],
},