diff --git a/crates/behavior/src/dock/workspace.rs b/crates/behavior/src/dock/workspace.rs index 5e724b4aa..14a752fe9 100644 --- a/crates/behavior/src/dock/workspace.rs +++ b/crates/behavior/src/dock/workspace.rs @@ -162,8 +162,8 @@ impl
Workspace
{
}
impl {
- /// Renames a panel in `layout`, `hidden` and `floated` (keys and anchors), keeping its place; all or nothing,
- /// and the revision stays. `MissingPanel` when `from` is in none of them, `DuplicatePanel` when `to` is
+ /// Renames a panel in `layout`, `hidden` and `floated` (keys and anchors), keeping its place; all or nothing.
+ /// An edit: it moves the revision and keeps the generation. `MissingPanel` when `from` is in none of them, `DuplicatePanel` when `to` is
/// already there.
pub fn rename(&mut self, from: &P, to: P) -> Result<(), DockError> {
if !self.holds(from) {
@@ -189,7 +189,9 @@ impl {
rename_in_location(location, &swap);
}
proposed.validate()?;
- *self = proposed;
+ let Workspace { layout, hidden, floated, .. } = proposed;
+ (self.layout, self.hidden, self.floated) = (layout, hidden, floated);
+ self.touch();
Ok(())
}
diff --git a/crates/behavior/tests/dock_apply.rs b/crates/behavior/tests/dock_apply.rs
index 57a3eb4cd..1d25354fd 100644
--- a/crates/behavior/tests/dock_apply.rs
+++ b/crates/behavior/tests/dock_apply.rs
@@ -474,6 +474,7 @@ fn a_renamed_panel_keeps_its_place_and_a_taken_name_changes_nothing() {
let swap = |panel: u32| if panel == from { 99 } else { panel };
let mut renamed = base.clone();
+ let (revision, generation) = (renamed.revision(), renamed.generation());
renamed.rename(&from, 99).unwrap_or_else(|e| panic!("{from}: {e:?}"));
let panels = |workspace: &Workspace