From 2632a55ddb21bfc41f307e6d85abff189f9823dd Mon Sep 17 00:00:00 2001 From: clover caruso Date: Thu, 24 Sep 2026 02:18:45 -0700 Subject: [PATCH] fix: open outlines that store only the level-zero indent OneNote writes a single Indent entry for an outline whose paragraphs are all top level, as in corpus/ink-edit; the layout demanded two and refused the page. Assisted-by: claude-opus-5.5 --- crates/canvas/src/outline.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/crates/canvas/src/outline.rs b/crates/canvas/src/outline.rs index 710c354b88f8d4e18df94175bb149d7c5d002c09..ccb747c769d8f1c7edc6086369d3715aaf526764 100644 --- a/crates/canvas/src/outline.rs +++ b/crates/canvas/src/outline.rs @@ -90,7 +90,7 @@ impl ParagraphTag { } pub(crate) fn indentation(level: u32, indents: &[f32], width: f32) -> Result { - if indents.len() < 2 || indents.iter().any(|v| !v.is_finite() || *v < 0.0) || level == 0 { + if indents.is_empty() || indents.iter().any(|v| !v.is_finite() || *v < 0.0) || level == 0 { return Err(LayoutError::InvalidIndentation); } let known = (level as usize).min(indents.len() - 1); @@ -536,9 +536,6 @@ pub(crate) fn outline_layout( definitions: &BTreeMap, width: f32, ) -> Result { - if outline.indents.len() < 2 || outline.indents.iter().any(|v| !v.is_finite() || *v < 0.0) { - return Err(LayoutError::InvalidIndentation); - } if !outline.unsupported.is_empty() { return Err(LayoutError::UnsupportedContent); } @@ -1125,6 +1122,11 @@ mod tests { outline.layout(&mut engine, &BTreeMap::new()), Err(LayoutError::InvalidIndentation) )); + // OneNote stores only the level-zero indent for an outline of top-level paragraphs. + outline.indents = vec![0.0]; + outline.paragraphs.truncate(1); + let single = outline.layout(&mut engine, &BTreeMap::new()).unwrap(); + assert_eq!(single.paragraphs[0].origin[0], 0.0); } #[test] -- 2.54.0