diff options
| author | Maxime Coste <frrrwww@gmail.com> | 2015-12-23 21:43:07 +0000 |
|---|---|---|
| committer | Maxime Coste <frrrwww@gmail.com> | 2015-12-23 22:20:25 +0000 |
| commit | 1d748a401726999959c9bc69e819c2fbbd97a565 (patch) | |
| tree | d522dc354bb9117b59c8636982561bd8f7f206da /src/normal.cc | |
| parent | 669fccc5e9c5327122fc9d653091e2de3a62d544 (diff) | |
Pass flags to the regex engine to correct anchors
Current behaviour was matching ^ $ for the current search start/end
(and \b was always matching begin/end as well).
Fixes #536
Diffstat (limited to 'src/normal.cc')
| -rw-r--r-- | src/normal.cc | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/normal.cc b/src/normal.cc index d5d0b4d3..54e7a558 100644 --- a/src/normal.cc +++ b/src/normal.cc @@ -797,8 +797,9 @@ void keep(Context& context, NormalParams) Vector<Selection> keep; for (auto& sel : context.selections()) { - if (regex_search(buffer.iterator_at(sel.min()), - utf8::next(buffer.iterator_at(sel.max()), buffer.end()), ex) == matching) + 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) keep.push_back(sel); } if (keep.empty()) |
