From 74fd60256945244fb99956b61d118110c18ab7e8 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Sat, 17 Feb 2018 20:36:07 +1100 Subject: [PATCH] '*' uses escaping of meta characters instead of \Q and \E Fixes #1825 --- src/normal.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/normal.cc b/src/normal.cc index 1019ef46..8e65d9f5 100644 --- a/src/normal.cc +++ b/src/normal.cc @@ -849,9 +849,9 @@ void use_selection_as_search_pattern(Context& context, NormalParams params) for (auto& sel : sels) { 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" : "", - buffer.string(beg, end), + escape(buffer.string(beg, end), "^$\\.*+?()[]{}|", '\\'), smart and is_eow(buffer, end) ? "\\b" : "")); }