Filter on consecutive sequences of characters.

The filters for the layout combo and document class combo share a
problem: If you type "beam", e.g, in the latter case, then we will
show any document class that contains those letters, in that order,
but not necessarily consecutively. This is extremely confusing and,
as José put it, just weird. So let's fix it.

I'd call this a bug so would be happy to see this in stable, too.
This commit is contained in:
Richard Kimberly Heck 2018-10-15 20:51:34 -04:00
parent d6cc58f4a3
commit 938ef60258
2 changed files with 6 additions and 6 deletions

View File

@ -292,13 +292,13 @@ QString CCItemDelegate::underlineFilter(QString const & s) const
static QString charFilterRegExpCC(QString const & filter)
{
QString re;
QString re = ".*";
for (int i = 0; i < filter.length(); ++i) {
QChar c = filter[i];
if (c.isLower())
re += ".*[" + QRegExp::escape(c) + QRegExp::escape(c.toUpper()) + "]";
re += "[" + QRegExp::escape(c) + QRegExp::escape(c.toUpper()) + "]";
else
re += ".*" + QRegExp::escape(c);
re += QRegExp::escape(c);
}
return re;
}

View File

@ -341,13 +341,13 @@ QString LayoutItemDelegate::underlineFilter(QString const & s) const
static QString charFilterRegExp(QString const & filter)
{
QString re;
QString re = ".*";
for (int i = 0; i < filter.length(); ++i) {
QChar c = filter[i];
if (c.isLower())
re += ".*[" + QRegExp::escape(c) + QRegExp::escape(c.toUpper()) + "]";
re += "["+ QRegExp::escape(c) + QRegExp::escape(c.toUpper()) + "]";
else
re += ".*" + QRegExp::escape(c);
re += QRegExp::escape(c);
}
return re;
}