uniquify selection contents before generating regex for '*'

Avoid generating regex with the same alternative repeated multiple
times.
This commit is contained in:
Maxime Coste 2022-08-05 20:10:11 +10:00
parent 89cd3c52eb
commit 26d14d52bb

View File

@ -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<HashSet>();
String pattern = join(patterns, '|', false);
const char reg = to_lower(params.reg ? params.reg : '/');