Fix common prefix search with no collator

This commit is contained in:
Přemysl Eric Janouch 2016-09-27 03:35:14 +02:00
parent c9eb47de7e
commit da6c46cba9
Signed by: p
GPG Key ID: B715679E3A361BE6
1 changed files with 7 additions and 1 deletions

View File

@ -979,10 +979,16 @@ stardict_longest_common_collation_prefix (StardictDict *sd,
int32_t pos1, pos2;
while ((pos1 = ubrk_next (it1)) != UBRK_DONE
&& (pos2 = ubrk_next (it2)) != UBRK_DONE)
{
if (sd->priv->collator)
{
if (!ucol_strcoll (sd->priv->collator, uc1, pos1, uc2, pos2))
longest = pos1;
}
// I'd need a new collator, so just do the minimal working thing
else if (pos1 == pos2 && !memcmp (uc1, uc2, pos1 * sizeof *uc1))
longest = pos1;
}
ubrk_close (it1);
ubrk_close (it2);