Merge the footprint pull request (f6f4585c, with #2144) into #2145

This commit is contained in:
prxnvt
2026-10-25 04:14:12 -04:00
2 changed files with 11 additions and 2 deletions
+7
View File
@@ -1043,6 +1043,9 @@ struct Saved {
/// The workbook as last saved: `sheet.activate` and the view commands move it to the /// The workbook as last saved: `sheet.activate` and the view commands move it to the
/// current workbook on a clean document, and the rollback puts the workbook back but not this. /// current workbook on a clean document, and the rollback puts the workbook back but not this.
saved: Option<Arc<Workbook>>, saved: Option<Arc<Workbook>>,
/// The document's revision: the rollback counts as a change, and front ends key their caches
/// on it, so a check that changed nothing leaves it as it was.
revision: Option<u64>,
sheet_selections: Vec<Selection>, sheet_selections: Vec<Selection>,
unlocked_ranges: Vec<(String, String)>, unlocked_ranges: Vec<(String, String)>,
trust: Trust, trust: Trust,
@@ -1072,6 +1075,7 @@ impl Saved {
active: s.active, active: s.active,
docs: s.docs.iter().map(|d| d.uid).collect(), docs: s.docs.iter().map(|d| d.uid).collect(),
saved: d.map(|d| d.saved.clone()), saved: d.map(|d| d.saved.clone()),
revision: d.map(|d| d.revision),
sheet_selections: d.map(|d| d.sheet_selections.clone()).unwrap_or_default(), sheet_selections: d.map(|d| d.sheet_selections.clone()).unwrap_or_default(),
unlocked_ranges: d.map(|d| d.unlocked_ranges.clone()).unwrap_or_default(), unlocked_ranges: d.map(|d| d.unlocked_ranges.clone()).unwrap_or_default(),
trust: d.map_or(Trust::Local, |d| d.trust), trust: d.map_or(Trust::Local, |d| d.trust),
@@ -1099,6 +1103,9 @@ impl Saved {
if let Some(saved) = self.saved { if let Some(saved) = self.saved {
d.saved = saved; d.saved = saved;
} }
if let Some(revision) = self.revision {
d.revision = revision;
}
d.sheet_selections = self.sheet_selections; d.sheet_selections = self.sheet_selections;
d.unlocked_ranges = self.unlocked_ranges; d.unlocked_ranges = self.unlocked_ranges;
d.trust = self.trust; d.trust = self.trust;
+4 -2
View File
@@ -304,12 +304,14 @@ fn shifting_makes_room_and_is_checked_again() {
let err = s.execute("macro.run", json!({"name": "Named"})).unwrap_err().to_string(); let err = s.execute("macro.run", json!({"name": "Named"})).unwrap_err().to_string();
assert!(err.contains("shifting the data didn't make room (E3 on Sheet1)"), "{err}"); assert!(err.contains("shifting the data didn't make room (E3 on Sheet1)"), "{err}");
assert!(Arc::ptr_eq(&s.doc().unwrap().wb, &start)); assert!(Arc::ptr_eq(&s.doc().unwrap().wb, &start));
// The check shifts and checks again as the run does, and puts everything back. // The check shifts and checks again as the run does, and puts everything back, the document's
// revision included.
let journal = s.journal.len(); let journal = s.journal.len();
let revision = s.doc().unwrap().revision;
let c = s.execute("macro.check", json!({"name": "Named"})).unwrap(); let c = s.execute("macro.check", json!({"name": "Named"})).unwrap();
assert_eq!((&c["ok"], &c["errors"]), (&json!(false), &json!(["Shifting the data doesn't make room (E3 on Sheet1)."])), "{c}"); assert_eq!((&c["ok"], &c["errors"]), (&json!(false), &json!(["Shifting the data doesn't make room (E3 on Sheet1)."])), "{c}");
assert!(Arc::ptr_eq(&s.doc().unwrap().wb, &start)); assert!(Arc::ptr_eq(&s.doc().unwrap().wb, &start));
assert_eq!(s.journal.len(), journal); assert_eq!((s.journal.len(), s.doc().unwrap().revision), (journal, revision));
// Where the shift does make room, the check says the run would go ahead. // Where the shift does make room, the check says the run would go ahead.
let mut s = super::s(); let mut s = super::s();
data(&mut s); data(&mut s);