Fix reverse search when extending

This commit is contained in:
Maxime Coste 2014-09-25 13:29:53 +01:00
parent 4c4d3cdd38
commit ecf8047bcc
2 changed files with 6 additions and 3 deletions

View File

@ -421,7 +421,7 @@ void select_next_match(const Buffer& buffer, SelectionList& selections,
if (mode == SelectMode::Replace)
{
for (auto& sel : selections)
sel = find_next_match<direction>(buffer, sel, regex);
sel = keep_direction(find_next_match<direction>(buffer, sel, regex), sel);
}
if (mode == SelectMode::Extend)
{
@ -430,7 +430,10 @@ void select_next_match(const Buffer& buffer, SelectionList& selections,
}
else if (mode == SelectMode::Append)
{
selections.push_back(find_next_match<direction>(buffer, selections.main(), regex));
auto sel = keep_direction(
find_next_match<direction>(buffer, selections.main(), regex),
selections.main());
selections.push_back(std::move(sel));
selections.set_main_index(selections.size() - 1);
}
selections.sort_and_merge_overlapping();

View File

@ -281,7 +281,7 @@ Selection find_next_match(const Buffer& buffer, const Selection& sel, const Rege
if (direction == Backward)
std::swap(begin, end);
return keep_direction({begin.coord(), end.coord(), std::move(captures)}, sel);
return {begin.coord(), end.coord(), std::move(captures)};
}
void select_all_matches(SelectionList& selections,