Commit 92c1659d authored by Orgad Shaneh's avatar Orgad Shaneh Committed by Orgad Shaneh

CamelHump: Prefer plain match over camel hump

For example:
Matching "lit" against "LiteralTable" should highlight "Lit" and not "Li"
and "T" from Table.

Change-Id: I8a0a9d0b0b90403745e85b1d3d20deaa551416eb
Reviewed-by: default avatarAndré Hartmann <aha_1980@gmx.de>
parent 4c62cbd6
......@@ -118,9 +118,9 @@ QRegularExpression CamelHumpMatcher::createCamelHumpRegExp(
first = false;
}
keyRegExp += ")|(" + plainRegExp + ')';
keyRegExp += ')';
return QRegularExpression(keyRegExp);
return QRegularExpression('(' + plainRegExp + ")|" + keyRegExp);
}
/*!
......
......@@ -136,12 +136,14 @@ void tst_CamelHumpMatcher::highlighting_data()
<< MatchStart{13} << MatchLength{1};
QTest::newRow("humps-continued") << "LoCa" << "VeryLongCamelHump"
<< MatchStart{4, 8} << MatchLength{2, 2};
QTest::newRow("duplicate-match") << "som" << "SomeMatch"
<< MatchStart{0} << MatchLength{3};
QTest::newRow("numbers") << "4" << "TestJust4Fun"
<< MatchStart{8} << MatchLength{1};
QTest::newRow("wildcard-asterisk") << "Lo*Hu" << "VeryLongCamelHump"
<< MatchStart{4, 13} << MatchLength{2, 2};
<< MatchStart{4} << MatchLength{11};
QTest::newRow("wildcard-question") << "Lo?g" << "VeryLongCamelHump"
<< MatchStart{4, 7} << MatchLength{2, 1};
<< MatchStart{4} << MatchLength{4};
QTest::newRow("middle-no-hump") << "window" << "mainwindow.cpp"
<< MatchStart{4} << MatchLength{6};
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment