actions: make find forward/backward incremental

This commit is contained in:
Andrzej Rybczak
2014-11-06 23:22:55 +01:00
parent 7c71df8dc7
commit 6a5f46a458
21 changed files with 236 additions and 229 deletions

View File

@@ -248,31 +248,22 @@ bool Browser::allowsSearching()
return true;
}
bool Browser::setSearchConstraint(const std::string &constraint)
void Browser::setSearchConstraint(const std::string &constraint)
{
if (constraint.empty())
{
m_search_predicate.clear();
return false;
}
else
{
m_search_predicate = RegexFilter<MPD::Item>(
boost::regex(constraint, Config.regex_type),
boost::bind(browserEntryMatcher, _1, _2, false)
);
return true;
}
m_search_predicate = RegexFilter<MPD::Item>(
boost::regex(constraint, Config.regex_type),
boost::bind(browserEntryMatcher, _1, _2, false)
);
}
void Browser::findForward(bool wrap)
void Browser::clearConstraint()
{
searchForward(w, m_search_predicate, wrap);
m_search_predicate.clear();
}
void Browser::findBackward(bool wrap)
bool Browser::find(SearchDirection direction, bool wrap, bool skip_current)
{
searchBackward(w, m_search_predicate, wrap);
return search(w, m_search_predicate, direction, wrap, skip_current);
}
/***********************************************************************/