Keep match whose end is closest to the selection in reverse regex
search.
This commit is contained in:
parent
b2a54b8416
commit
6a8507ce40
|
@ -239,13 +239,12 @@ inline bool find_last_match(const Buffer& buffer, const BufferIterator& pos,
|
||||||
const bool is_pos_eol = is_eol(buffer, pos.coord());
|
const bool is_pos_eol = is_eol(buffer, pos.coord());
|
||||||
const bool is_pos_eow = is_eow(buffer, pos.coord());
|
const bool is_pos_eow = is_eow(buffer, pos.coord());
|
||||||
auto begin = buffer.begin();
|
auto begin = buffer.begin();
|
||||||
while (regex_search(begin, pos, matches, regex,
|
while (begin != pos and regex_search(begin, pos, matches, regex,
|
||||||
match_flags(is_bol(begin.coord()), is_pos_eol, is_pos_eow)))
|
match_flags(is_bol(begin.coord()), is_pos_eol, is_pos_eow)))
|
||||||
{
|
{
|
||||||
if (begin == matches[0].second)
|
begin = utf8::next(matches[0].first, pos);
|
||||||
break;
|
if (res.empty() or matches[0].second > res[0].second)
|
||||||
begin = matches[0].second;
|
res.swap(matches);
|
||||||
res.swap(matches);
|
|
||||||
}
|
}
|
||||||
return not res.empty();
|
return not res.empty();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user