]> git.lyx.org Git - features.git/commitdiff
Filter on consecutive sequences of characters.
authorRichard Kimberly Heck <rikiheck@lyx.org>
Tue, 16 Oct 2018 00:51:34 +0000 (20:51 -0400)
committerRichard Kimberly Heck <rikiheck@lyx.org>
Fri, 19 Oct 2018 01:49:31 +0000 (21:49 -0400)
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
src/frontends/qt4/LayoutBox.cpp

index 757196377a67441aad0b68e5f1921d62691d7b26..a762822384aa791bb8c964fd10e9bfc9e5d67ecc 100644 (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;
 }
index 85df1694b813e2a91cb4698d5502f50c4fb83854..130b2c7723582db565a7c53fb1e914036e5d39cd 100644 (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;
 }