From fb9b362b6e6722d0bdcb367033e316536963c25a Mon Sep 17 00:00:00 2001 From: Christian Duerr Date: Thu, 7 Jan 2021 05:19:37 +0000 Subject: Fix inefficient search initialization The creation of the renderable search iterator was doing a lot of work even when absolutely no search is active at the moment. To resolve this problem, an early return now makes sure that a search is active before going through the trouble of creating an iterator for it. --- alacritty/src/display.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'alacritty/src') diff --git a/alacritty/src/display.rs b/alacritty/src/display.rs index b5c2bfa9..5e885b53 100644 --- a/alacritty/src/display.rs +++ b/alacritty/src/display.rs @@ -492,12 +492,11 @@ impl Display { self.renderer.with_api(&config.ui_config, &size_info, |mut api| { // Iterate over all non-empty cells in the grid. for mut cell in grid_cells { - // Invert the active match in vi-less search. - let cell_point = Point::new(cell.line, cell.column); + // Invert the active match during search. if cell.is_match && viewport_match .as_ref() - .map_or(false, |viewport_match| viewport_match.contains(&cell_point)) + .map_or(false, |viewport_match| viewport_match.contains(&cell.point())) { let colors = config.colors.search.focused_match; let match_fg = colors.foreground.color(cell.fg, cell.bg); -- cgit