commit 938ef60258d6df3468afdafde689aacac6e8ac51
Author: Richard Kimberly Heck <[email protected]>
Date: Mon Oct 15 20:51:34 2018 -0400
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.
---
src/frontends/qt4/CategorizedCombo.cpp | 6 +++---
src/frontends/qt4/LayoutBox.cpp | 6 +++---
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/frontends/qt4/CategorizedCombo.cpp
b/src/frontends/qt4/CategorizedCombo.cpp
index 7571963..a762822 100644
--- a/src/frontends/qt4/CategorizedCombo.cpp
+++ b/src/frontends/qt4/CategorizedCombo.cpp
@@ -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;
}
diff --git a/src/frontends/qt4/LayoutBox.cpp b/src/frontends/qt4/LayoutBox.cpp
index 85df169..130b2c7 100644
--- a/src/frontends/qt4/LayoutBox.cpp
+++ b/src/frontends/qt4/LayoutBox.cpp
@@ -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;
}