Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit ea7cd2ca authored by Alex Neundorf's avatar Alex Neundorf

Search&Replace: trim file types list from whitespace

When splitting the string lists for the filetypes to search
and the files to exclude, strip leading and trailing whitespace
from the list members. My colleague stumbled a few times upon this,
when the search found nothing because of a space before the next
matching pattern.

CCMAIL:kare.sars@iki.fi

Alex
parent ed238254
......@@ -59,8 +59,11 @@ void FolderFilesList::generateList(const QString &folder,
m_hidden = hidden;
m_symlinks = symlinks;
m_binary = binary;
m_types = types.split(QLatin1Char(','), QString::SkipEmptyParts);
m_types.clear();
foreach (QString type, types.split(QLatin1Char(','), QString::SkipEmptyParts)) {
m_types << type.trimmed();
}
if (m_types.isEmpty()) {
m_types << QStringLiteral("*");
}
......@@ -68,7 +71,7 @@ void FolderFilesList::generateList(const QString &folder,
QStringList tmpExcludes = excludes.split(QLatin1Char(','));
m_excludeList.clear();
for (int i=0; i<tmpExcludes.size(); i++) {
QRegExp rx(tmpExcludes[i]);
QRegExp rx(tmpExcludes[i].trimmed());
rx.setPatternSyntax(QRegExp::Wildcard);
m_excludeList << rx;
}
......
......@@ -526,7 +526,7 @@ QStringList KatePluginSearchView::filterFiles(const QStringList& files) const
QStringList tmpTypes = types.split(QLatin1Char(','));
QVector<QRegExp> typeList;
for (int i=0; i<tmpTypes.size(); i++) {
QRegExp rx(tmpTypes[i]);
QRegExp rx(tmpTypes[i].trimmed());
rx.setPatternSyntax(QRegExp::Wildcard);
typeList << rx;
}
......@@ -534,7 +534,7 @@ QStringList KatePluginSearchView::filterFiles(const QStringList& files) const
QStringList tmpExcludes = excludes.split(QLatin1Char(','));
QVector<QRegExp> excludeList;
for (int i=0; i<tmpExcludes.size(); i++) {
QRegExp rx(tmpExcludes[i]);
QRegExp rx(tmpExcludes[i].trimmed());
rx.setPatternSyntax(QRegExp::Wildcard);
excludeList << rx;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment