diff options
author | Christian Duerr <chrisduerr@users.noreply.github.com> | 2018-12-22 17:16:54 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-22 17:16:54 +0000 |
commit | 2f9b815ebdcee4558284e5e9cef6ef282dc87b08 (patch) | |
tree | 09bf03e5c69d9e7e99e04ff55983ea5774435b86 /src/display.rs | |
parent | dad44134e2546dffec918a00169d32c6f9edc709 (diff) | |
download | alacritty-2f9b815ebdcee4558284e5e9cef6ef282dc87b08.tar.gz alacritty-2f9b815ebdcee4558284e5e9cef6ef282dc87b08.zip |
Add proper underline and strikeout support
This makes use of the new rectangle rendering methods used to display
the colored visual bell to add proper underline and strikeout support to
Alacritty.
Diffstat (limited to 'src/display.rs')
-rw-r--r-- | src/display.rs | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/display.rs b/src/display.rs index 120cd1dc..b1575c58 100644 --- a/src/display.rs +++ b/src/display.rs @@ -25,6 +25,7 @@ use crate::config::Config; use font::{self, Rasterize}; use crate::meter::Meter; use crate::renderer::{self, GlyphCache, QuadRenderer}; +use crate::renderer::lines::Lines; use crate::term::{Term, SizeInfo, RenderableCell}; use crate::sync::FairMutex; use crate::window::{self, Window}; @@ -410,19 +411,27 @@ impl Display { { let glyph_cache = &mut self.glyph_cache; + let metrics = glyph_cache.font_metrics(); + let mut cell_line_rects = Lines::new(&metrics, &size_info); // Draw grid { let _sampler = self.meter.sampler(); self.renderer.with_api(config, &size_info, |mut api| { - // Draw the grid - api.render_cells(grid_cells.iter(), glyph_cache); + // Iterate over all non-empty cells in the grid + for cell in grid_cells { + // Update underline/strikeout + cell_line_rects.update_lines(&cell); + + // Draw the cell + api.render_cell(cell, glyph_cache); + } }); } // Draw rectangles - self.renderer.draw_rects(config, &size_info, visual_bell_intensity); + self.renderer.draw_rects(config, &size_info, visual_bell_intensity, cell_line_rects); // Draw render timer if self.render_timer { @@ -490,4 +499,3 @@ impl Display { self.window().set_ime_spot(LogicalPosition::from((nspot_x, nspot_y))); } } - |