Finding next matches start from seleciton min/max instead of cursor

uses min for backward serching, max for forward searching.
This commit is contained in:
Maxime Coste 2014-09-26 00:27:23 +01:00
parent bfef8fd5aa
commit 9beba90060

View File

@ -261,7 +261,7 @@ bool find_match_in_buffer(const Buffer& buffer, const BufferIterator pos,
template<Direction direction> template<Direction direction>
Selection find_next_match(const Buffer& buffer, const Selection& sel, const Regex& regex) 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; auto end = begin;
CaptureList captures; CaptureList captures;