diff --git a/src/libs/utils/fuzzymatcher.cpp b/src/libs/utils/fuzzymatcher.cpp index 50c3fb7fba9..819c723f6d3 100644 --- a/src/libs/utils/fuzzymatcher.cpp +++ b/src/libs/utils/fuzzymatcher.cpp @@ -72,7 +72,7 @@ QRegularExpression FuzzyMatcher::createRegExp( const QLatin1String lowercaseWordFirst("(?<=\\b|[A-Z0-9_])"); const QLatin1String uppercaseWordContinuation("[a-z0-9_]*"); const QLatin1String lowercaseWordContinuation("(?:[a-zA-Z0-9]*_)?"); - const QLatin1String upperSnakeWordContinuation("[A-Z0-9]*_"); + const QLatin1String upperSnakeWordContinuation("[A-Z0-9]*_?"); keyRegExp += "(?:"; for (const QChar &c : pattern) { if (!c.isLetterOrNumber()) { diff --git a/tests/auto/utils/fuzzymatcher/tst_fuzzymatcher.cpp b/tests/auto/utils/fuzzymatcher/tst_fuzzymatcher.cpp index c59dbb0f58c..3a64524d591 100644 --- a/tests/auto/utils/fuzzymatcher/tst_fuzzymatcher.cpp +++ b/tests/auto/utils/fuzzymatcher/tst_fuzzymatcher.cpp @@ -86,6 +86,7 @@ void tst_FuzzyMatcher::fuzzyMatcher_data() QTest::newRow("middle-no-hump") << "window" << "mainwindow.cpp" << 4; QTest::newRow("case-insensitive") << "window" << "MAINWINDOW.cpp" << 4; QTest::newRow("case-insensitive-2") << "wINDow" << "MainwiNdow.cpp" << 4; + QTest::newRow("uppercase-word-and-humps") << "htvideoele" << "HTMLVideoElement" << 0; } typedef QVector> Matches; @@ -159,6 +160,8 @@ void tst_FuzzyMatcher::highlighting_data() << Matches{{4, 2}, {7, 1}}; QTest::newRow("middle-no-hump") << "window" << "mainwindow.cpp" << Matches{{4, 6}}; + QTest::newRow("uppercase-word-and-humps") << "htvideoele" << "HTMLVideoElement" + << Matches{{0, 2}, {4, 8}}; } QTEST_APPLESS_MAIN(tst_FuzzyMatcher)