fix(panes): do not crash when closing fixed pane
@@ -1647,14 +1647,16 @@ impl<'a> PaneGrid<'a> {
pub fn fill_space_over_pane(&mut self, id: PaneId) -> bool {
// true => successfully filled space over pane
// false => didn't succeed, so didn't do anything
+ log::info!("fill_space_over_pane");
let (freed_width, freed_height) = {
let panes = self.panes.borrow_mut();
let pane_to_close = panes.get(&id).unwrap();
let freed_space = pane_to_close.position_and_size();
- let freed_width = freed_space.cols.as_percent().unwrap();
- let freed_height = freed_space.rows.as_percent().unwrap();
+ let freed_width = freed_space.cols.as_percent();
+ let freed_height = freed_space.rows.as_percent();
(freed_width, freed_height)
};
+ if let (Some(freed_width), Some(freed_height)) = (freed_width, freed_height) {
if let Some((panes_to_grow, direction)) = self.find_panes_to_grow(id) {
self.grow_panes(&panes_to_grow, direction, (freed_width, freed_height));
let side_length = match direction {
@@ -1669,6 +1671,7 @@ impl<'a> PaneGrid<'a> {
let _ = pane_resizer.layout(direction, side_length);
return true;
}
+ }
false
}
pub fn find_room_for_new_pane(&self) -> Option<(PaneId, Direction)> {
