Skip to content

DesignCraft: An open-source page and layout design editor written by scratch in pure Rust

Merge #411: Undo: a command that runs another is one undo step

aionggaee3748be249
diff --cc crates/engine/src/guard.rs
index f0af8a709,41b028f08..4f8c17a31
--- a/crates/engine/src/guard.rs
+++ b/crates/engine/src/guard.rs
@@@ -35,7 -35,8 +35,8 @@@ pub fn install_panic_hook()
impl Session {
/// Run command `id` (`f`) inside the guard.
pub(crate) fn guarded(&mut self, id: &str, f: impl FnOnce(&mut Session) -> Result<Value>) -> Result<Value> {
- let before = self.active().map(|d| (d.uid, d.doc.clone(), d.selection.clone(), d.revision));
+ let before = self.active().map(|d| (d.uid, d.doc.clone(), d.selection.clone()));
+ let in_undo_step = self.in_undo_step;
match catch_unwind(AssertUnwindSafe(|| f(self))) {
Ok(r) => r,
Err(payload) => {