Leading and trailing whitespaces are now trimmed from refined scraper searches.

This commit is contained in:
Leon Styhre 2021-09-21 22:08:27 +02:00
parent 49075f3fc4
commit 8f82809a89

View file

@ -777,7 +777,16 @@ void GuiScraperSearch::updateThumbnail()
void GuiScraperSearch::openInputScreen(ScraperSearchParams& params)
{
auto searchForFunc = [&](const std::string& name) {
auto searchForFunc = [&](std::string name) {
// Trim leading and trailing whitespaces.
name.erase(name.begin(), std::find_if(name.begin(), name.end(), [](char c) {
return !std::isspace(static_cast<unsigned char>(c));
}));
name.erase(std::find_if(name.rbegin(), name.rend(),
[](char c) { return !std::isspace(static_cast<unsigned char>(c)); })
.base(),
name.end());
stop();
mRefinedSearch = true;
params.nameOverride = name;