on master help sign in
Deduplicate regexes in search_selection command (#3941)
eb6fd28A-Walrus
helix-term/src/commands.rs+2
@@ -1760,6 +1760,8 @@ fn search_selection(cx: &mut Context) {
1760 .selection(view.id)
1760 .selection(view.id)
1761 .iter()
1761 .iter()
1762 .map(|selection| regex::escape(&selection.fragment(contents)))
1762 .map(|selection| regex::escape(&selection.fragment(contents)))
1763+ .collect::<HashSet<_>>() // Collect into hashset to deduplicate identical regexes
1764+ .into_iter()
1763 .collect::<Vec<_>>()
1765 .collect::<Vec<_>>()
1764 .join("|");
1766 .join("|");
1765
1767