Skip to content

Commit

Permalink
fix(tiled-panes): recover from full stack (#4011)
Browse files Browse the repository at this point in the history
  • Loading branch information
imsnif authored Feb 21, 2025
1 parent 6f8e9cc commit 2c8ef3b
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions zellij-server/src/panes/tiled_panes/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ impl TiledPanes {
fn add_pane(
&mut self,
pane_id: PaneId,
mut pane: Box<dyn Pane>,
pane: Box<dyn Pane>,
should_relayout: bool,
client_id: Option<ClientId>,
) {
Expand All @@ -245,15 +245,21 @@ impl TiledPanes {
return;
}
}
self.add_pane_without_stacked_resize(pane_id, pane, should_relayout)
}
fn add_pane_without_stacked_resize(
&mut self,
pane_id: PaneId,
mut pane: Box<dyn Pane>,
should_relayout: bool,
) {
let cursor_height_width_ratio = self.cursor_height_width_ratio();
let mut pane_grid = TiledPaneGrid::new(
&mut self.panes,
&self.panes_to_hide,
*self.display_area.borrow(),
*self.viewport.borrow(),
);
// TODO: make sure this is really the same as the pre-stacked-resizes function... and
// behaves the same and all
let pane_id_and_split_direction =
pane_grid.find_room_for_new_pane(cursor_height_width_ratio);
match pane_id_and_split_direction {
Expand Down Expand Up @@ -317,8 +323,8 @@ impl TiledPanes {
self.set_force_render(); // TODO: why do we need this?
return;
},
Err(e) => {
log::error!("Failed to add pane to stack: {:?}", e);
Err(_e) => {
return self.add_pane_without_stacked_resize(pane_id, pane, should_relayout);
},
}
}
Expand Down

0 comments on commit 2c8ef3b

Please sign in to comment.