From 94dfa20fa0be3c3ff784ac17dea0c410a659eeb0 Mon Sep 17 00:00:00 2001 From: Matthew Farrow Date: Thu, 8 Oct 2026 22:06:22 -0400 Subject: [PATCH] EPS import: joined text lays out its bounds afresh The pieces joined into one text kept the layout cached for the first piece, so the selection box covered only that piece. Co-Authored-By: Claude Sonnet 5.5 --- crates/eps/src/import/native.rs | 3 +++ crates/eps/src/import/tests_native.rs | 3 +++ 2 files changed, 6 insertions(+) diff --git a/crates/eps/src/import/native.rs b/crates/eps/src/import/native.rs index 100fede0..e6b8edec 100644 --- a/crates/eps/src/import/native.rs +++ b/crates/eps/src/import/native.rs @@ -798,6 +798,9 @@ fn join_pieces(parts: &mut Vec>, lines: &[(String, Point)]) { && let NodeKind::Text(t) = &mut node.kind { t.runs = runs.into_iter().flatten().collect(); + // The layout cached for the first piece is not this text's. + t.cached_bounds = None; + t.cached_baselines.clear(); } let mut gone: Vec = rest.clone(); gone.sort_unstable_by(|a, b| b.cmp(a)); diff --git a/crates/eps/src/import/tests_native.rs b/crates/eps/src/import/tests_native.rs index 6fddba75..93a00a5a 100644 --- a/crates/eps/src/import/tests_native.rs +++ b/crates/eps/src/import/tests_native.rs @@ -423,6 +423,9 @@ fn a_line_the_page_draws_in_pieces_goes_to_its_text_object_whole() { let texts: Vec = group.children().unwrap().iter().filter_map(|n| if let NodeKind::Text(t) = &n.kind { Some(t.plain_text()) } else { None }).collect(); assert_eq!(texts, ["Hi there"]); + // Its bounds are laid out afresh for the whole text, not those of the first piece. + let NodeKind::Text(t) = &group.children().unwrap()[0].kind else { panic!("text") }; + assert!(t.cached_bounds.is_none() && t.cached_baselines.is_empty()); } #[test]