diff --git a/src/selectors.hh b/src/selectors.hh index 5107226e..c985cc72 100644 --- a/src/selectors.hh +++ b/src/selectors.hh @@ -261,7 +261,7 @@ bool find_match_in_buffer(const Buffer& buffer, const BufferIterator pos, template Selection find_next_match(const Buffer& buffer, const Selection& sel, const Regex& regex) { - auto begin = buffer.iterator_at(sel.cursor()); + auto begin = buffer.iterator_at(direction == Backward ? sel.min() : sel.max()); auto end = begin; CaptureList captures;