Skip to content

Commit eb6fd28

Browse files
authored
Deduplicate regexes in search_selection command (#3941)
1 parent e621848 commit eb6fd28

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

helix-term/src/commands.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

0 commit comments

Comments
 (0)