P1e: persist undo and redo history across reloads

This commit is contained in:
Emil
2026-11-01 01:53:05 +03:00
parent 346035e869
commit 9d84c2f162
9 changed files with 113 additions and 16 deletions
+14 -2
View File
@@ -141,6 +141,8 @@ pub struct ProjectData {
pub cores: Vec<Core>,
pub journal: Vec<JournalEntry>,
pub seq: u64,
pub history: Vec<ProjectEdit>,
pub redo: Vec<ProjectEdit>,
}
#[derive(Clone, Serialize, Deserialize)]
@@ -271,8 +273,8 @@ impl Session {
cores: data.cores,
journal: data.journal,
project_name: data.name,
history: Vec::new(),
redo: Vec::new(),
history: data.history,
redo: data.redo,
engine,
};
session.sanitize_faces();
@@ -296,6 +298,14 @@ impl Session {
!self.redo.is_empty()
}
pub fn history(&self) -> &[ProjectEdit] {
&self.history
}
pub fn redo(&self) -> &[ProjectEdit] {
&self.redo
}
pub fn bpm(&self) -> f32 {
self.bpm
}
@@ -1227,6 +1237,8 @@ mod tests {
cores: vec![test_core()],
journal: Vec::new(),
seq: 0,
history: Vec::new(),
redo: Vec::new(),
},
);
engine.clear();