'*' uses escaping of meta characters instead of \Q and \E

Fixes #1825
This commit is contained in:
Maxime Coste 2018-02-17 20:36:07 +11:00
parent f25e8640b8
commit 74fd602569

View File

@ -849,9 +849,9 @@ void use_selection_as_search_pattern(Context& context, NormalParams params)
for (auto& sel : sels) for (auto& sel : sels)
{ {
const auto beg = sel.min(), end = buffer.char_next(sel.max()); const auto beg = sel.min(), end = buffer.char_next(sel.max());
patterns.push_back(format("{}\\Q{}\\E{}", patterns.push_back(format("{}{}{}",
smart and is_bow(buffer, beg) ? "\\b" : "", smart and is_bow(buffer, beg) ? "\\b" : "",
buffer.string(beg, end), escape(buffer.string(beg, end), "^$\\.*+?()[]{}|", '\\'),
smart and is_eow(buffer, end) ? "\\b" : "")); smart and is_eow(buffer, end) ? "\\b" : ""));
} }