From 938ef60258d6df3468afdafde689aacac6e8ac51 Mon Sep 17 00:00:00 2001 From: Richard Kimberly Heck Date: Mon, 15 Oct 2018 20:51:34 -0400 Subject: [PATCH] Filter on consecutive sequences of characters. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 757196377a..a762822384 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 85df1694b8..130b2c7723 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; } -- 2.39.2