diff options
| author | Aram Drevekenin <aram@poor.dev> | 2025-09-25 12:14:37 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-09-25 12:14:37 +0200 |
| commit | bfbc7cd2af8bd13c81b87eb36f363ee406738db6 (patch) | |
| tree | fdae8cfdfecf9bb69196ae2f0879a57b3c61d533 | |
| parent | fix(resurrection): occasional status-bar pop-out after resurrection (#4440) (diff) | |
| download | sl0ppij-bfbc7cd2af8bd13c81b87eb36f363ee406738db6.tar.gz sl0ppij-bfbc7cd2af8bd13c81b87eb36f363ee406738db6.tar.xz sl0ppij-bfbc7cd2af8bd13c81b87eb36f363ee406738db6.zip | |
fix(resurrection): allow splitting fixed one-row fixed panes (#4442)
* fix(resurrection): allow splitting fixed one-row fixed panes
* docs(changelog): add PR
| -rw-r--r-- | CHANGELOG.md | 1 | ||||
| -rw-r--r-- | zellij-utils/src/session_serialization.rs | 24 |
2 files changed, 13 insertions, 12 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 9e250885..e5e6afb3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) * refactor: move logical structures from client to server (https://github.com/zellij-org/zellij/pull/4383) * fix: make sessions compatible across versions (https://github.com/zellij-org/zellij/pull/4439) * fix: occasional status-bar pop-out after resurrecting a session (https://github.com/zellij-org/zellij/pull/4440) +* fix: properly serialize/resurrect layouts with one-line split panes (https://github.com/zellij-org/zellij/pull/4442) ## [0.43.1] - 2025-08-08 * fix: pane rename backspace regression (https://github.com/zellij-org/zellij/pull/4346) diff --git a/zellij-utils/src/session_serialization.rs b/zellij-utils/src/session_serialization.rs index cfa3d997..837a3bf2 100644 --- a/zellij-utils/src/session_serialization.rs +++ b/zellij-utils/src/session_serialization.rs @@ -1,5 +1,5 @@ use kdl::{KdlDocument, KdlEntry, KdlNode, KdlValue}; -use std::collections::{BTreeMap, HashMap}; +use std::collections::{BTreeMap, HashMap, HashSet}; use std::path::PathBuf; use crate::{ @@ -789,14 +789,6 @@ fn get_tiled_panes_layout_from_panegeoms( } } - if let Some(SplitSize::Fixed(fixed_size)) = split_size { - if fixed_size == 1 && !new_geoms.is_empty() { - // invalid state, likely an off-by-one error somewhere, we do not serialize - log::error!("invalid state, not serializing"); - return None; - } - } - let new_split_sizes = get_split_sizes(&new_constraints); for (subgeoms, subsplit_size) in new_geoms.iter().zip(new_split_sizes) { @@ -810,9 +802,7 @@ fn get_tiled_panes_layout_from_panegeoms( } } let children_are_stacked = children_split_direction == SplitDirection::Horizontal - && new_geoms - .iter() - .all(|c| c.iter().all(|c| c.geom.is_stacked())); + && all_geoms_are_from_the_same_stack(&new_geoms); Some(TiledPaneLayout { children_split_direction, split_size, @@ -822,6 +812,16 @@ fn get_tiled_panes_layout_from_panegeoms( }) } +fn all_geoms_are_from_the_same_stack(manifests: &Vec<Vec<PaneLayoutManifest>>) -> bool { + let mut stack_ids = HashSet::new(); + for manifest_group in manifests { + for pane_layout_manifest in manifest_group { + stack_ids.insert(pane_layout_manifest.geom.stacked); + } + } + stack_ids.len() == 1 && !stack_ids.contains(&None) +} + fn get_floating_panes_layout_from_panegeoms( manifests: &Vec<PaneLayoutManifest>, ) -> Vec<FloatingPaneLayout> { |
