summaryrefslogtreecommitdiff
path: root/src/normal.cc
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2016-11-12 18:03:45 +0000
committerMaxime Coste <frrrwww@gmail.com>2016-11-12 18:03:54 +0000
commit9d9beb7e3a2fed083ebb0190565cbd4469b92bbd (patch)
tree91a733b4156f241b8f6f80dea6a754e457406289 /src/normal.cc
parent85ce5db08a6461f5fef13cc4f6b090c858698d91 (diff)
Pass regex flags on keep matching/not matching
Related to #921
Diffstat (limited to 'src/normal.cc')
-rw-r--r--src/normal.cc7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/normal.cc b/src/normal.cc
index 6d01b5e7..8e2e0936 100644
--- a/src/normal.cc
+++ b/src/normal.cc
@@ -837,7 +837,12 @@ void keep(Context& context, NormalParams)
{
auto begin = buffer.iterator_at(sel.min());
auto end = utf8::next(buffer.iterator_at(sel.max()), buffer.end());
- if (regex_search(begin, end, ex, RegexConstant::match_any) == matching)
+ const auto flags = match_flags(is_bol(begin.coord()),
+ is_eol(buffer, end.coord()),
+ is_bow(buffer, begin.coord()),
+ is_eow(buffer, end.coord())) |
+ RegexConstant::match_any;
+ if (regex_search(begin, end, ex, flags) == matching)
keep.push_back(sel);
}
if (keep.empty())