diff --git a/src/selectors.cc b/src/selectors.cc index 3d9b453d..2c657b80 100644 --- a/src/selectors.cc +++ b/src/selectors.cc @@ -965,7 +965,8 @@ Vector split_on_matches(const Buffer& buffer, ConstArrayView vm{*regex.impl()}; for (auto& sel : selections) { - auto begin = buffer.iterator_at(sel.min()); + auto sel_begin = buffer.iterator_at(sel.min()); + auto begin = sel_begin; auto sel_end = utf8::next(buffer.iterator_at(sel.max()), buf_end); for (auto&& match : RegexIterator{begin, sel_end, vm, match_flags(buffer, begin, sel_end)}) @@ -975,7 +976,7 @@ Vector split_on_matches(const Buffer& buffer, ConstArrayView