From a8a1ecd60b2900a5a346660669de06cdabcc01d5 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Wed, 11 Nov 2026 22:31:04 +0000 Subject: [PATCH] fix(render): a loose list holding block references gets the index --- crates/render/src/pipeline.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/crates/render/src/pipeline.rs b/crates/render/src/pipeline.rs index 51d5f16d8..0ab699bba 100644 --- a/crates/render/src/pipeline.rs +++ b/crates/render/src/pipeline.rs @@ -222,7 +222,8 @@ pub(crate) fn with_point_view(d: &Drawing, space: &Space, opts: &Options) -> Opt o } -/// Loose entity lists shorter than this look layers up by scanning them rather than building an index. +/// Loose entity lists shorter than this, with no block reference (whose contents expand to many +/// objects), look layers up by scanning rather than building an index. const SMALL_LIST: usize = 64; /// Build the display list for a set of loose entities (previews, rubber bands). @@ -236,7 +237,11 @@ pub fn build_entities<'a, I: IntoIterator>(d: &Drawing, ents: } else { opts }; - let layers = if ents.len() < SMALL_LIST { LayerIndex::linear() } else { LayerIndex::new(d) }; + let layers = if ents.len() < SMALL_LIST && !ents.iter().any(|e| matches!(e.kind, EntityKind::Insert(_))) { + LayerIndex::linear() + } else { + LayerIndex::new(d) + }; let mut b = Builder { list: DisplayList::default(), opts,