From e10e11d1de62731cb95cb85063a33206afb950c5 Mon Sep 17 00:00:00 2001 From: LGUG2Z Date: Tue, 21 Sep 2021 10:07:03 -0700 Subject: [PATCH] fix(wm): preserve resize dimensions on promotion Whatever resize dimensions are at the front of the workspace were previously being thrown away and overwritten with None whenever a Promote command was being handled. This commit preserves any resize dimensions that may already be there and restores them after the container promotion has been completed. fix #40 --- komorebi/src/workspace.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/komorebi/src/workspace.rs b/komorebi/src/workspace.rs index 68803115..c91b4820 100644 --- a/komorebi/src/workspace.rs +++ b/komorebi/src/workspace.rs @@ -48,7 +48,6 @@ pub struct Workspace { #[serde(skip_serializing)] #[getset(get = "pub", set = "pub")] latest_layout: Vec, - #[serde(skip_serializing)] #[getset(get = "pub", get_mut = "pub")] resize_dimensions: Vec>, #[getset(get = "pub", set = "pub")] @@ -324,11 +323,14 @@ impl Workspace { } pub fn promote_container(&mut self) -> Result<()> { + let resize = self.resize_dimensions_mut().remove(0); let container = self .remove_focused_container() .ok_or_else(|| anyhow!("there is no container"))?; + self.containers_mut().push_front(container); - self.resize_dimensions_mut().insert(0, None); + self.resize_dimensions_mut().insert(0, resize); + self.focus_container(0); Ok(())