Display squiggly underlines underneath text with diagnostics
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
parent
52594fe250
commit
b9b255652f
7 changed files with 119 additions and 72 deletions
|
@ -25,7 +25,7 @@ struct StackingContext {
|
|||
pub struct Layer {
|
||||
clip_bounds: Option<RectF>,
|
||||
quads: Vec<Quad>,
|
||||
underlines: Vec<Quad>,
|
||||
underlines: Vec<Underline>,
|
||||
images: Vec<Image>,
|
||||
shadows: Vec<Shadow>,
|
||||
glyphs: Vec<Glyph>,
|
||||
|
@ -76,6 +76,15 @@ pub struct Border {
|
|||
pub left: bool,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Default, Debug)]
|
||||
pub struct Underline {
|
||||
pub origin: Vector2F,
|
||||
pub width: f32,
|
||||
pub thickness: f32,
|
||||
pub color: Color,
|
||||
pub squiggly: bool,
|
||||
}
|
||||
|
||||
impl<'de> Deserialize<'de> for Border {
|
||||
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
|
||||
where
|
||||
|
@ -183,7 +192,7 @@ impl Scene {
|
|||
self.active_layer().push_image(image)
|
||||
}
|
||||
|
||||
pub fn push_underline(&mut self, underline: Quad) {
|
||||
pub fn push_underline(&mut self, underline: Underline) {
|
||||
self.active_layer().push_underline(underline)
|
||||
}
|
||||
|
||||
|
@ -277,11 +286,11 @@ impl Layer {
|
|||
self.quads.as_slice()
|
||||
}
|
||||
|
||||
fn push_underline(&mut self, underline: Quad) {
|
||||
fn push_underline(&mut self, underline: Underline) {
|
||||
self.underlines.push(underline);
|
||||
}
|
||||
|
||||
pub fn underlines(&self) -> &[Quad] {
|
||||
pub fn underlines(&self) -> &[Underline] {
|
||||
self.underlines.as_slice()
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue