Skip to content
Merged
6 changes: 3 additions & 3 deletions src/gui/map/map_find_feature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,23 +198,23 @@ void MapFindFeature::findNext()
Object* next_match = nullptr; // the next match after pivot_object
map->clearObjectSelection(false);

auto search = [&first_match, &pivot_object, &next_match](Object* object) {
auto search = [&](Object* object) {
if (next_match)
return;

bool after_pivot = (pivot_object == nullptr);
if (object == pivot_object)
pivot_object = nullptr;

if (isSelectable(object))
if (isSelectable(object) && query(object))
{
if (after_pivot)
next_match = object;
else if (!first_match)
first_match = object;
}
};
map->getCurrentPart()->applyOnMatchingObjects(search, std::cref(query));
map->getCurrentPart()->applyOnAllObjects(search);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reverting part of my change here: The current object might no longer match the query, but we still want to see it when determining the next match.

if (!next_match)
next_match = first_match;
if (next_match)
Expand Down