authorgravatar for git@paperclover.netclover caruso <git@paperclover.net> 2026-09-24 02:18:45-07:00
committergravatar for git@paperclover.netclover caruso <git@paperclover.net> 2026-09-25 20:26:21-07:00
log2632a55ddb21bfc41f307e6d85abff189f9823dd
treed15774914457b37f726d8a0964847e41f87445fa
parent4960c06d9ae353c4c2379730578d6105b3e8da4d
signature Signed by SSH key SHA256:52mNGHRsVFBDED9IAX5pe+LRWUefqTbxEReunq21QvU

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

1 files changed, 6 insertions(+), 4 deletions(-)

crates/canvas/src/outline.rs+6-4
......@@ -90,7 +90,7 @@ impl ParagraphTag {
9090}
9191
9292pub(crate) fn indentation(level: u32, indents: &[f32], width: f32) -> Result<f32, LayoutError> {
93 if indents.len() < 2 || indents.iter().any(|v| !v.is_finite() || *v < 0.0) || level == 0 {
93 if indents.is_empty() || indents.iter().any(|v| !v.is_finite() || *v < 0.0) || level == 0 {
9494 return Err(LayoutError::InvalidIndentation);
9595 }
9696 let known = (level as usize).min(indents.len() - 1);
......@@ -536,9 +536,6 @@ pub(crate) fn outline_layout(
536536 definitions: &BTreeMap<ExGuid, Definition>,
537537 width: f32,
538538) -> Result<OutlineLayout, LayoutError> {
539 if outline.indents.len() < 2 || outline.indents.iter().any(|v| !v.is_finite() || *v < 0.0) {
540 return Err(LayoutError::InvalidIndentation);
541 }
542539 if !outline.unsupported.is_empty() {
543540 return Err(LayoutError::UnsupportedContent);
544541 }
......@@ -1125,6 +1122,11 @@ mod tests {
11251122 outline.layout(&mut engine, &BTreeMap::new()),
11261123 Err(LayoutError::InvalidIndentation)
11271124 ));
1125 // OneNote stores only the level-zero indent for an outline of top-level paragraphs.
1126 outline.indents = vec![0.0];
1127 outline.paragraphs.truncate(1);
1128 let single = outline.layout(&mut engine, &BTreeMap::new()).unwrap();
1129 assert_eq!(single.paragraphs[0].origin[0], 0.0);
11281130 }
11291131
11301132 #[test]