Deduplicate regexes in search_selection command (#3941)
commiteb6fd283dcf041ecf822fd8f2d4520abb2a26df9
authorA-Walrus <58790821+A-Walrus@users.noreply.github.com>
dateThu 22 Sep 2022, 18:33 (4 years ago)
parente621848
helix-term/src/commands.rs+2
@@ -1760,6 +1760,8 @@ fn search_selection(cx: &mut Context) {
17601760 .selection(view.id)
17611761 .iter()
17621762 .map(|selection| regex::escape(&selection.fragment(contents)))
1763+ .collect::<HashSet<_>>() // Collect into hashset to deduplicate identical regexes
1764+ .into_iter()
17631765 .collect::<Vec<_>>()
17641766 .join("|");
17651767