summaryrefslogtreecommitdiff
path: root/crates/typst-library/src
diff options
context:
space:
mode:
authorSébastien d'Herbais de Thun <sebastien.d.herbais@gmail.com>2023-11-13 15:49:38 +0100
committerGitHub <noreply@github.com>2023-11-13 15:49:38 +0100
commitc427ca9e4ea7d184fd4ff4b78f52c746e1ee9dc0 (patch)
tree385f5094b2b3e4fb5726b6b84e492a4ee5316777 /crates/typst-library/src
parentd16ab29068552584879902562e41d0e95f328179 (diff)
Assign spans to `raw.line` (#2672)
Diffstat (limited to 'crates/typst-library/src')
-rw-r--r--crates/typst-library/src/text/raw.rs31
1 files changed, 19 insertions, 12 deletions
diff --git a/crates/typst-library/src/text/raw.rs b/crates/typst-library/src/text/raw.rs
index 4f672be9..166319d0 100644
--- a/crates/typst-library/src/text/raw.rs
+++ b/crates/typst-library/src/text/raw.rs
@@ -325,12 +325,15 @@ impl Synthesize for RawElem {
synt::Highlighter::new(theme),
&mut |_, range, style| styled(&text[range], foreground, style),
&mut |i, range, line| {
- seq.push(RawLine::new(
- i + 1,
- count,
- EcoString::from(&text[range]),
- Content::sequence(line.drain(..)),
- ));
+ seq.push(
+ RawLine::new(
+ i + 1,
+ count,
+ EcoString::from(&text[range]),
+ Content::sequence(line.drain(..)),
+ )
+ .spanned(self.span()),
+ );
},
)
.highlight();
@@ -353,12 +356,15 @@ impl Synthesize for RawElem {
line_content.push(styled(piece, foreground, style));
}
- seq.push(RawLine::new(
- i as i64 + 1,
- count,
- EcoString::from(line),
- Content::sequence(line_content),
- ));
+ seq.push(
+ RawLine::new(
+ i as i64 + 1,
+ count,
+ EcoString::from(line),
+ Content::sequence(line_content),
+ )
+ .spanned(self.span()),
+ );
}
} else {
let lines = text.lines();
@@ -369,6 +375,7 @@ impl Synthesize for RawElem {
EcoString::from(line),
TextElem::packed(line),
)
+ .spanned(self.span())
}));
};