From 1cb4d2965fdb68e062f5a791af214bb7ec972cdb Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Thu, 1 Oct 2015 19:35:42 +0100 Subject: [PATCH] Fix '*' word boundary detection at begin/end of buffer --- src/normal.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/normal.cc b/src/normal.cc index e0648abd..5eed5bcf 100644 --- a/src/normal.cc +++ b/src/normal.cc @@ -647,9 +647,9 @@ void use_selection_as_search_pattern(Context& context, NormalParams) auto content = "\\Q" + buffer.string(begin.base().coord(), end.base().coord()) + "\\E"; if (smart) { - if (begin == buffer.begin() or (is_word(*begin) and not is_word(*(begin-1)))) + if (is_word(*begin) and (begin == buffer.begin() or not is_word(*(begin-1)))) content = "\\b" + content; - if (end == buffer.end() or (is_word(*(end-1)) and not is_word(*end))) + if (is_word(*(end-1)) and (end == buffer.end() or not is_word(*end))) content = content + "\\b"; } patterns.push_back(std::move(content));