Tweak subsequence_match_smart_case

This commit is contained in:
Maxime Coste 2016-03-28 15:18:15 +01:00
parent 2a9875bd58
commit 94f4531bc8

View File

@ -75,12 +75,11 @@ static bool subsequence_match_smart_case(StringView str, StringView subseq, int&
index_sum = 0; index_sum = 0;
auto it = str.begin(); auto it = str.begin();
int index = 0; int index = 0;
for (auto subseq_it = subseq.begin(); subseq_it != subseq.end(); for (auto subseq_it = subseq.begin(); subseq_it != subseq.end();)
subseq_it = utf8::next(subseq_it, subseq.end()))
{ {
if (it == str.end()) if (it == str.end())
return false; return false;
const Codepoint c = utf8::codepoint(subseq_it, subseq.end()); const Codepoint c = utf8::read_codepoint(subseq_it, subseq.end());
while (not smartcase_eq(c, utf8::read_codepoint(it, subseq.end()))) while (not smartcase_eq(c, utf8::read_codepoint(it, subseq.end())))
{ {
++index; ++index;