Deduplicate regexes in search_selection command (#3941)

pull/3948/head
A-Walrus 2 years ago committed by GitHub
parent e621848d07
commit eb6fd283dc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1760,6 +1760,8 @@ fn search_selection(cx: &mut Context) {
.selection(view.id) .selection(view.id)
.iter() .iter()
.map(|selection| regex::escape(&selection.fragment(contents))) .map(|selection| regex::escape(&selection.fragment(contents)))
.collect::<HashSet<_>>() // Collect into hashset to deduplicate identical regexes
.into_iter()
.collect::<Vec<_>>() .collect::<Vec<_>>()
.join("|"); .join("|");

Loading…
Cancel
Save