aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorA-Walrus2022-09-22 15:33:30 +0000
committerGitHub2022-09-22 15:33:30 +0000
commiteb6fd283dcf041ecf822fd8f2d4520abb2a26df9 (patch)
tree4f2d831b20735c8022724be5197688cff07af06c
parente621848d075c1751ab2be6f3a82ac67490ec7909 (diff)
Deduplicate regexes in search_selection command (#3941)
-rw-r--r--helix-term/src/commands.rs2
1 files changed, 2 insertions, 0 deletions
diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs
index e869446e..a5203352 100644
--- a/helix-term/src/commands.rs
+++ b/helix-term/src/commands.rs
@@ -1760,6 +1760,8 @@ fn search_selection(cx: &mut Context) {
.selection(view.id)
.iter()
.map(|selection| regex::escape(&selection.fragment(contents)))
+ .collect::<HashSet<_>>() // Collect into hashset to deduplicate identical regexes
+ .into_iter()
.collect::<Vec<_>>()
.join("|");