Start regex search from selection min/max depending on search direction

This commit is contained in:
Maxime Coste 2014-10-09 18:55:58 +01:00
parent 7ca095c2b9
commit c94b343c65

View File

@ -267,7 +267,9 @@ Selection find_next_match(const Buffer& buffer, const Selection& sel, const Rege
CaptureList captures; CaptureList captures;
MatchResults matches; MatchResults matches;
bool found = false; bool found = false;
if ((found = find_match_in_buffer<direction>(buffer, utf8::next(begin, buffer.end()), matches, regex))) auto pos = direction == Forward ? utf8::next(begin, buffer.end())
: utf8::previous(begin, buffer.begin());
if ((found = find_match_in_buffer<direction>(buffer, pos, matches, regex)))
{ {
begin = matches[0].first; begin = matches[0].first;
end = matches[0].second; end = matches[0].second;