diff options
| author | Laurenz <laurmaedje@gmail.com> | 2022-06-10 23:53:20 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2022-06-10 23:54:16 +0200 |
| commit | ed6550fdb08eae92bffab6b6b137b1e0eebf62c6 (patch) | |
| tree | 74152a38f7aa2ed2ac2fa190e81494422700ca36 /src/library/text | |
| parent | 6aff11057bc88257c9383137952bb41b5b85c3dc (diff) | |
Bump dependencies
Diffstat (limited to 'src/library/text')
| -rw-r--r-- | src/library/text/raw.rs | 7 | ||||
| -rw-r--r-- | src/library/text/shaping.rs | 6 |
2 files changed, 7 insertions, 6 deletions
diff --git a/src/library/text/raw.rs b/src/library/text/raw.rs index 31db811a..8db4cf3e 100644 --- a/src/library/text/raw.rs +++ b/src/library/text/raw.rs @@ -90,7 +90,9 @@ impl Show for RawNode { seq.push(Content::Linebreak { justified: false }); } - for (style, piece) in highlighter.highlight(line, &SYNTAXES) { + for (style, piece) in + highlighter.highlight_line(line, &SYNTAXES).into_iter().flatten() + { seq.push(styled(piece, foreground, style)); } } @@ -177,6 +179,7 @@ pub static THEME: Lazy<Theme> = Lazy::new(|| Theme { item("string", Some("#298e0d"), None), item("punctuation.shortcut", Some("#1d6c76"), None), item("constant.character.escape", Some("#1d6c76"), None), + item("invalid", Some("#ff0000"), None), ], }); @@ -185,7 +188,7 @@ fn item(scope: &str, color: Option<&str>, font_style: Option<FontStyle>) -> Them ThemeItem { scope: scope.parse().unwrap(), style: StyleModifier { - foreground: color.map(|s| s.parse().unwrap()), + foreground: color.map(|s| s.parse::<RgbaColor>().unwrap().into()), background: None, font_style, }, diff --git a/src/library/text/shaping.rs b/src/library/text/shaping.rs index 1f3d2f55..591abb5e 100644 --- a/src/library/text/shaping.rs +++ b/src/library/text/shaping.rs @@ -221,14 +221,12 @@ impl<'a> ShapedText<'a> { let x_advance = face.to_em(ttf.glyph_hor_advance(glyph_id)?); let cluster = self.glyphs.last().map(|g| g.cluster).unwrap_or_default(); self.width += x_advance.at(self.size); - let baseline_shift = self.styles.get(TextNode::BASELINE); - self.glyphs.to_mut().push(ShapedGlyph { face_id, glyph_id: glyph_id.0, x_advance, x_offset: Em::zero(), - y_offset: Em::from_length(baseline_shift, self.size), + y_offset: Em::zero(), cluster, safe_to_break: true, c: '-', @@ -491,7 +489,7 @@ fn shape_tofus(ctx: &mut ShapingContext, base: usize, text: &str, face_id: FaceI glyph_id: 0, x_advance, x_offset: Em::zero(), - y_offset: Em::from_length(ctx.styles.get(TextNode::BASELINE), ctx.size), + y_offset: Em::zero(), cluster: base + cluster, safe_to_break: true, c, |
