From da6d7f4530f490ec262bd640f9c51d0bc3d5ef53 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Mon, 28 Nov 2016 21:02:41 +0000 Subject: Always consider end of selection is not and eol for keep Fixes #921 --- src/normal.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/normal.cc b/src/normal.cc index 1b420faa..affe69c1 100644 --- a/src/normal.cc +++ b/src/normal.cc @@ -837,13 +837,15 @@ void keep(Context& context, NormalParams) if (ex.empty()) return; const Buffer& buffer = context.buffer(); + Vector keep; for (auto& sel : context.selections()) { auto begin = buffer.iterator_at(sel.min()); auto end = utf8::next(buffer.iterator_at(sel.max()), buffer.end()); - const auto flags = match_flags(is_bol(begin.coord()), - is_eol(buffer, end.coord()), + // We do not consider if end is on an eol, as it seems to + // give more intuitive behaviours in keep use cases. + const auto flags = match_flags(is_bol(begin.coord()), false, is_bow(buffer, begin.coord()), is_eow(buffer, end.coord())) | RegexConstant::match_any; -- cgit v1.2.3