From 28d9be1f75af9227dcf5d52ad212a7c4fec88e96 Mon Sep 17 00:00:00 2001 From: aiongg Date: Sat, 21 Nov 2026 05:50:51 +0000 Subject: [PATCH] ui-contract: the replay audit compares journal entries as a replay calls them A replay calls its journal entries unshifted when the shift leaves every record as it is (a pinned record, one that shows an overlay), as egui's records do. The audit shifted them anyway, and RecordShift::clip cut the clip of a menu layer's rows to the clip around the view (TabRow with its menu open). Entry::at holds the rule for the replay and the audit. --- crates/ui-contract/src/runtime/replay.rs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/crates/ui-contract/src/runtime/replay.rs b/crates/ui-contract/src/runtime/replay.rs index 2ec9e5ccc..760f5cb47 100644 --- a/crates/ui-contract/src/runtime/replay.rs +++ b/crates/ui-contract/src/runtime/replay.rs @@ -93,6 +93,15 @@ impl PartialEq for Entry { } } +impl Entry { + /// The entry at the place `shift` names. A shift that leaves every record as it is (`RecordShift::is_none`, a + /// pinned record's) leaves the entry too, as it leaves egui's records: a clip a layer the record shows sets lies + /// outside the clip around the record, which `RecordShift::clip` would cut it to. + fn at(&self, shift: &RecordShift) -> Entry { + if shift.is_none() { self.clone() } else { self.0.shifted(shift) } + } +} + impl fmt::Debug for Entry { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { self.0.describe(f) @@ -350,7 +359,7 @@ impl Record { if let Some(diff) = self.focus.first_difference(&run.focus) { found.push(format!("focus: {diff}")); } - let shifted: Vec = self.journal.iter().map(|entry| entry.0.shifted(shift)).collect(); + let shifted: Vec = self.journal.iter().map(|entry| entry.at(shift)).collect(); let (left, right) = (&shifted, &run.journal); if let Some(index) = left .iter() @@ -416,7 +425,7 @@ pub(crate) fn replay(ctx: &Context, record: &Record, shift: &RecordShift) { let noting = recording(ctx); if noting { pass_state::with::(ctx, |recorder| { - recorder.journal.extend(record.journal.iter().map(|entry| if shift.is_none() { entry.clone() } else { entry.0.shifted(shift) })); + recorder.journal.extend(record.journal.iter().map(|entry| entry.at(shift))); recorder.replaying = true; }); }