Add span information to realized ParElem
(#2675)
This commit is contained in:
parent
f56813a778
commit
f39a8bc015
@ -637,7 +637,15 @@ impl<'a> ParBuilder<'a> {
|
||||
|
||||
fn finish(self) -> (Content, StyleChain<'a>) {
|
||||
let (children, shared) = self.0.finish();
|
||||
(ParElem::new(children.to_vec()).pack(), shared)
|
||||
|
||||
// Find the first span that isn't detached.
|
||||
let span = children
|
||||
.iter()
|
||||
.map(|(cnt, _)| cnt.span())
|
||||
.find(|span| !span.is_detached())
|
||||
.unwrap_or_else(Span::detached);
|
||||
|
||||
(ParElem::new(children.to_vec()).spanned(span).pack(), shared)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -252,7 +252,9 @@ impl<'a, 'b, 'v> MathContext<'a, 'b, 'v> {
|
||||
// because it will be placed somewhere probably not at the left margin
|
||||
// it will overflow. So emulate an `hbox` instead and allow the paragraph
|
||||
// to extend as far as needed.
|
||||
let span = elem.span();
|
||||
let frame = ParElem::new(vec![Prehashed::new(elem)])
|
||||
.spanned(span)
|
||||
.layout(
|
||||
self.vt,
|
||||
self.outer.chain(&self.local),
|
||||
|
Loading…
x
Reference in New Issue
Block a user