Fix backward search searching from on char before the corret one.

Fixes #406
This commit is contained in:
Maxime Coste 2015-09-14 14:28:45 +01:00
parent a2b4bf09fd
commit e0049bb587
4 changed files with 4 additions and 2 deletions

View File

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

View File

@ -0,0 +1 @@
<a-/>xxx<ret>

View File

@ -0,0 +1 @@
xxx%(y)yyxxx

View File

@ -0,0 +1 @@
1.1,1.3