From b07e045d7e0d327c1e2a92e05c331cd7e7e1182f Mon Sep 17 00:00:00 2001 From: aiongg Date: Thu, 22 Oct 2026 02:19:18 +0000 Subject: [PATCH] Integration: #3335 header Esc test allows the half-pixel return scroll that #3201 brings #3201 makes entering an empty header scroll to it; Esc then scrolls back to the caret, landing 0.5 px from the start (17291.0 vs 17290.5). The test checks the view is back within a pixel. --- crates/ui-egui/src/lib.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/crates/ui-egui/src/lib.rs b/crates/ui-egui/src/lib.rs index c66d99452..38e9e835d 100644 --- a/crates/ui-egui/src/lib.rs +++ b/crates/ui-egui/src/lib.rs @@ -4770,7 +4770,10 @@ mod tests { frame(&mut a, Vec::new()); } assert_eq!(a.session.sel, before.0, "Esc left the header for where the caret was"); - assert_eq!(a.canvas.scroll_offset, before.1, "the view stays on that page"); + // Entering an empty header scrolls to it (#3201) and Esc scrolls back to the caret, which + // can land half a pixel from where the view started. + let drift = a.canvas.scroll_offset - before.1; + assert!(drift.x.abs() <= 1.0 && drift.y.abs() <= 1.0, "the view stays on that page: {:?} vs {:?}", a.canvas.scroll_offset, before.1); } fn control_frame(a: &mut WordApp, ctx: &egui::Context, focused: bool) {