parent
719eb16a5e
commit
da6d7f4530
|
@ -837,13 +837,15 @@ void keep(Context& context, NormalParams)
|
||||||
if (ex.empty())
|
if (ex.empty())
|
||||||
return;
|
return;
|
||||||
const Buffer& buffer = context.buffer();
|
const Buffer& buffer = context.buffer();
|
||||||
|
|
||||||
Vector<Selection> keep;
|
Vector<Selection> keep;
|
||||||
for (auto& sel : context.selections())
|
for (auto& sel : context.selections())
|
||||||
{
|
{
|
||||||
auto begin = buffer.iterator_at(sel.min());
|
auto begin = buffer.iterator_at(sel.min());
|
||||||
auto end = utf8::next(buffer.iterator_at(sel.max()), buffer.end());
|
auto end = utf8::next(buffer.iterator_at(sel.max()), buffer.end());
|
||||||
const auto flags = match_flags(is_bol(begin.coord()),
|
// We do not consider if end is on an eol, as it seems to
|
||||||
is_eol(buffer, end.coord()),
|
// give more intuitive behaviours in keep use cases.
|
||||||
|
const auto flags = match_flags(is_bol(begin.coord()), false,
|
||||||
is_bow(buffer, begin.coord()),
|
is_bow(buffer, begin.coord()),
|
||||||
is_eow(buffer, end.coord())) |
|
is_eow(buffer, end.coord())) |
|
||||||
RegexConstant::match_any;
|
RegexConstant::match_any;
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
%<a-s><a-k>^$<ret>
|
3
test/regression/921-keep-empty-line-matches-all-lines/in
Normal file
3
test/regression/921-keep-empty-line-matches-all-lines/in
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
non-empty
|
||||||
|
non-empty
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user