diff --git a/cpp/ycm/Result.cpp b/cpp/ycm/Result.cpp index 8a83d1f2..f43a257f 100644 --- a/cpp/ycm/Result.cpp +++ b/cpp/ycm/Result.cpp @@ -29,11 +29,11 @@ namespace YouCompleteMe namespace { -template< class T > -int LongestCommonSubsequenceLength(const T &first, const T &second) +int LongestCommonSubsequenceLength(const std::string &first, + const std::string &second) { - const T &longer = first.size() > second.size() ? first : second; - const T &shorter = first.size() > second.size() ? second : first; + const std::string &longer = first.size() > second.size() ? first : second; + const std::string &shorter = first.size() > second.size() ? second : first; int longer_len = longer.size(); int shorter_len = shorter.size(); @@ -45,7 +45,7 @@ int LongestCommonSubsequenceLength(const T &first, const T &second) { for (int j = 0; j < shorter_len; ++j ) { - if ( longer[ i ] == shorter[ j ] ) + if ( toupper( longer[ i ] ) == toupper( shorter[ j ] ) ) current[ j + 1 ] = previous[ j ] + 1; else current[ j + 1 ] = std::max( current[ j ], previous[ j + 1 ] ); diff --git a/cpp/ycm/tests/Completer_test.cpp b/cpp/ycm/tests/Completer_test.cpp index b33d2053..3938dc22 100644 --- a/cpp/ycm/tests/Completer_test.cpp +++ b/cpp/ycm/tests/Completer_test.cpp @@ -134,6 +134,12 @@ TEST( CompleterTest, RatioUtilizationTieBreak ) ElementsAre( "acaaCaaFooGxx", "aCaafoog" ) ); + EXPECT_THAT( Completer( Candidates( + "acaaCaaFooGxx", + "aCaafoog" ) ).CandidatesForQuery( "caaFoo" ), + ElementsAre( "acaaCaaFooGxx", + "aCaafoog" ) ); + EXPECT_THAT( Completer( Candidates( "FooBarQux", "FooBarQuxZaa" ) ).CandidatesForQuery( "fbq" ),