From 26d14d52bb922ccdf896fd1dae392f6cbbbb132e Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Fri, 5 Aug 2022 20:10:11 +1000 Subject: [PATCH] uniquify selection contents before generating regex for '*' Avoid generating regex with the same alternative repeated multiple times. --- src/normal.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/normal.cc b/src/normal.cc index 68a5fd6f0..c310817de 100644 --- a/src/normal.cc +++ b/src/normal.cc @@ -983,7 +983,7 @@ void use_selection_as_search_pattern(Context& context, NormalParams params) smart and is_bow(buffer, beg) ? "\\b" : "", escape(buffer.string(beg, end), "^$\\.*+?()[]{}|", '\\'), smart and is_eow(buffer, end) ? "\\b" : ""); - }); + }) | gather(); String pattern = join(patterns, '|', false); const char reg = to_lower(params.reg ? params.reg : '/');