diff options
| author | Laurenz <laurmaedje@gmail.com> | 2022-11-17 12:40:58 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2022-11-17 12:46:26 +0100 |
| commit | cabd0908e230e451bd9f1394390f8c5deb17182e (patch) | |
| tree | 665fe796b8487a0913fbc35aeed527c20050eca3 /library/src/text | |
| parent | bf59c08a0a601eeac4354c505cab15e65601c8e8 (diff) | |
Handle paragraph indent at a later stage
Diffstat (limited to 'library/src/text')
| -rw-r--r-- | library/src/text/par.rs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/library/src/text/par.rs b/library/src/text/par.rs index 3e72b034..df02bc3c 100644 --- a/library/src/text/par.rs +++ b/library/src/text/par.rs @@ -393,6 +393,26 @@ fn collect<'a>( let mut segments = vec![]; let mut iter = par.0.iter().peekable(); + let indent = styles.get(ParNode::INDENT); + if !indent.is_zero() + && par + .0 + .items() + .find_map(|child| { + if child.is::<TextNode>() || child.is::<SmartQuoteNode>() { + Some(true) + } else if child.has::<dyn LayoutInline>() { + Some(false) + } else { + None + } + }) + .unwrap_or_default() + { + full.push(SPACING_REPLACE); + segments.push((Segment::Spacing(indent.into()), *styles)); + } + while let Some((child, map)) = iter.next() { let styles = map.chain(styles); let segment = if child.is::<SpaceNode>() { |
