Skip to content

Commit 1801863

Browse files
A-WalrusShekhinah Memmel
authored andcommitted
Deduplicate regexes in search_selection command (helix-editor#3941)
1 parent a7969ae commit 1801863

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
@@ -1763,6 +1763,8 @@ fn search_selection(cx: &mut Context) {
17631763
.selection(view.id)
17641764
.iter()
17651765
.map(|selection| regex::escape(&selection.fragment(contents)))
1766+
.collect::<HashSet<_>>() // Collect into hashset to deduplicate identical regexes
1767+
.into_iter()
17661768
.collect::<Vec<_>>()
17671769
.join("|");
17681770

0 commit comments

Comments
 (0)