diff options
author | Joe Wilm <joe@jwilm.com> | 2016-12-29 16:05:32 -0500 |
---|---|---|
committer | Joe Wilm <joe@jwilm.com> | 2016-12-29 16:05:32 -0500 |
commit | 818a2f6161a718f8f9762a972a5c42e756ccff51 (patch) | |
tree | 442f50e1507fb80f561c32804a6b33d169862f06 /src | |
parent | d06360216d3f10a0d42f576e6a859de88436a7d6 (diff) | |
download | alacritty-818a2f6161a718f8f9762a972a5c42e756ccff51.tar.gz alacritty-818a2f6161a718f8f9762a972a5c42e756ccff51.zip |
Add super hacky underline drawing
Using underscores because it's easy. It's also wrong.
cc #11
Diffstat (limited to 'src')
-rw-r--r-- | src/renderer/mod.rs | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/src/renderer/mod.rs b/src/renderer/mod.rs index 79cfd665..54db4851 100644 --- a/src/renderer/mod.rs +++ b/src/renderer/mod.rs @@ -753,9 +753,25 @@ impl<'a> RenderApi<'a> { }; // Add cell to batch if glyph available - if let Some(glyph) = glyph_cache.get(&glyph_key, self) { - self.add_render_item(&cell, glyph); - } + glyph_cache.get(&glyph_key, self) + .map(|glyph| self.add_render_item(&cell, glyph)) + .and_then(|_| { + // FIXME This is a super hacky way to do underlined text. During + // a time crunch to release 0.1, this seemed like a really + // easy, clean hack. + if cell.flags.contains(cell::UNDERLINE) { + let glyph_key = GlyphKey { + font_key: font_key, + size: glyph_cache.font_size, + c: '_' + }; + + glyph_cache.get(&glyph_key, self) + } else { + None + } + }) + .map(|underscore| self.add_render_item(&cell, underscore)); } } } |