aboutsummaryrefslogtreecommitdiff
path: root/alacritty/src
diff options
context:
space:
mode:
authorChristian Duerr <contact@christianduerr.com>2021-01-07 05:19:37 +0000
committerGitHub <noreply@github.com>2021-01-07 05:19:37 +0000
commitfb9b362b6e6722d0bdcb367033e316536963c25a (patch)
tree0a6f81d03783aeea034b10d46fb1b7cb47ab40ae /alacritty/src
parent9f560b3e11374118afb9575135dc220d0ace267d (diff)
downloadr-alacritty-fb9b362b6e6722d0bdcb367033e316536963c25a.tar.gz
r-alacritty-fb9b362b6e6722d0bdcb367033e316536963c25a.tar.bz2
r-alacritty-fb9b362b6e6722d0bdcb367033e316536963c25a.zip
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.
Diffstat (limited to 'alacritty/src')
-rw-r--r--alacritty/src/display.rs5
1 files changed, 2 insertions, 3 deletions
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);