From 4fc56fd3035896d3917f14c469678e9e901aa870 Mon Sep 17 00:00:00 2001 From: aiongg Date: Thu, 22 Oct 2026 21:29:04 +0000 Subject: [PATCH] Reading blocks documents that over-budget page content is an error and truncation covers forms --- crates/edit/src/text.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/crates/edit/src/text.rs b/crates/edit/src/text.rs index 1f35bcd47..12ed6a207 100644 --- a/crates/edit/src/text.rs +++ b/crates/edit/src/text.rs @@ -2514,13 +2514,16 @@ pub struct ReadingBlocks { /// The paragraphs, as [`reading_blocks`] returns them. pub blocks: Vec, /// The page draws forms nested deeper than [`MAX_FORM_DEPTH`], more of them than - /// [`MAX_FORM_VISITS`], or more content and forms than one page's decode budget. Reading - /// leaves those out to stay bounded on hostile files, so their text is missing from - /// `blocks`; [`crate::reading_images`] walks the same forms and misses their images too. + /// [`MAX_FORM_VISITS`], or forms that run past what the page's content left of its decode + /// budget. Reading leaves those forms out to stay bounded on hostile files, so their text + /// is missing from `blocks`; [`crate::reading_images`] walks the same forms and misses + /// their images too. pub truncated: bool, } -/// [`reading_blocks`], saying whether the limits that bound reading left text out. +/// [`reading_blocks`], saying whether the limits that bound reading left text out. A page +/// whose `/Contents` alone runs past its decode budget is an [`EditError::Invalid`], not a +/// truncated result. pub fn reading_blocks_checked(doc: &Document, page: usize) -> Result { let (lines, truncated) = reading_lines(doc, page)?; Ok(ReadingBlocks { blocks: regions::group_reading_blocks(&lines), truncated })