From 8f82809a89149ba0cda8394124bf552fe5bf18f3 Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Tue, 21 Sep 2021 22:08:27 +0200 Subject: [PATCH] Leading and trailing whitespaces are now trimmed from refined scraper searches. --- es-app/src/guis/GuiScraperSearch.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/es-app/src/guis/GuiScraperSearch.cpp b/es-app/src/guis/GuiScraperSearch.cpp index 93ff9f680..93d70ffa2 100644 --- a/es-app/src/guis/GuiScraperSearch.cpp +++ b/es-app/src/guis/GuiScraperSearch.cpp @@ -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(c)); + })); + name.erase(std::find_if(name.rbegin(), name.rend(), + [](char c) { return !std::isspace(static_cast(c)); }) + .base(), + name.end()); + stop(); mRefinedSearch = true; params.nameOverride = name;