From 46c0f352c40ecb68653421cb178a297acaf00c6d Mon Sep 17 00:00:00 2001 From: Christian Duerr Date: Thu, 9 Jul 2020 21:45:22 +0000 Subject: Add regex scrollback buffer search This adds a new regex search which allows searching the entire scrollback and jumping between matches using the vi mode. All visible matches should be highlighted unless their lines are excessively long. This should help with performance since highlighting is done during render time. Fixes #1017. --- alacritty/src/renderer/mod.rs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'alacritty/src/renderer/mod.rs') diff --git a/alacritty/src/renderer/mod.rs b/alacritty/src/renderer/mod.rs index b2940a93..7dc037a1 100644 --- a/alacritty/src/renderer/mod.rs +++ b/alacritty/src/renderer/mod.rs @@ -298,7 +298,7 @@ impl GlyphCache { pub fn update_font_size( &mut self, - font: config::Font, + font: &config::Font, dpr: f64, loader: &mut L, ) -> Result<(), font::Error> { @@ -307,7 +307,7 @@ impl GlyphCache { // Recompute font keys. let (regular, bold, italic, bold_italic) = - Self::compute_font_keys(&font, &mut self.rasterizer)?; + Self::compute_font_keys(font, &mut self.rasterizer)?; self.rasterizer.get_glyph(GlyphKey { font_key: regular, c: 'm', size: font.size })?; let metrics = self.rasterizer.metrics(regular, font.size)?; @@ -968,29 +968,29 @@ impl<'a, C> RenderApi<'a, C> { /// errors. pub fn render_string( &mut self, - string: &str, - line: Line, glyph_cache: &mut GlyphCache, - color: Option, + line: Line, + string: &str, + fg: Rgb, + bg: Option, ) { - let bg_alpha = color.map(|_| 1.0).unwrap_or(0.0); - let col = Column(0); + let bg_alpha = bg.map(|_| 1.0).unwrap_or(0.0); let cells = string .chars() .enumerate() .map(|(i, c)| RenderableCell { line, - column: col + i, + column: Column(i), inner: RenderableCellContent::Chars({ let mut chars = [' '; cell::MAX_ZEROWIDTH_CHARS + 1]; chars[0] = c; chars }), - bg: color.unwrap_or(Rgb { r: 0, g: 0, b: 0 }), - fg: Rgb { r: 0, g: 0, b: 0 }, flags: Flags::empty(), bg_alpha, + fg, + bg: bg.unwrap_or(Rgb { r: 0, g: 0, b: 0 }), }) .collect::>(); -- cgit