mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-07-12 08:02:40 +02:00
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
This commit is contained in:
@@ -48,7 +48,6 @@ pub struct Workspace {
|
|||||||
#[serde(skip_serializing)]
|
#[serde(skip_serializing)]
|
||||||
#[getset(get = "pub", set = "pub")]
|
#[getset(get = "pub", set = "pub")]
|
||||||
latest_layout: Vec<Rect>,
|
latest_layout: Vec<Rect>,
|
||||||
#[serde(skip_serializing)]
|
|
||||||
#[getset(get = "pub", get_mut = "pub")]
|
#[getset(get = "pub", get_mut = "pub")]
|
||||||
resize_dimensions: Vec<Option<Rect>>,
|
resize_dimensions: Vec<Option<Rect>>,
|
||||||
#[getset(get = "pub", set = "pub")]
|
#[getset(get = "pub", set = "pub")]
|
||||||
@@ -324,11 +323,14 @@ impl Workspace {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn promote_container(&mut self) -> Result<()> {
|
pub fn promote_container(&mut self) -> Result<()> {
|
||||||
|
let resize = self.resize_dimensions_mut().remove(0);
|
||||||
let container = self
|
let container = self
|
||||||
.remove_focused_container()
|
.remove_focused_container()
|
||||||
.ok_or_else(|| anyhow!("there is no container"))?;
|
.ok_or_else(|| anyhow!("there is no container"))?;
|
||||||
|
|
||||||
self.containers_mut().push_front(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);
|
self.focus_container(0);
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|||||||
Reference in New Issue
Block a user