Fix common prefix search with no collator
This commit is contained in:
parent
c9eb47de7e
commit
da6c46cba9
|
@ -979,10 +979,16 @@ stardict_longest_common_collation_prefix (StardictDict *sd,
|
||||||
int32_t pos1, pos2;
|
int32_t pos1, pos2;
|
||||||
while ((pos1 = ubrk_next (it1)) != UBRK_DONE
|
while ((pos1 = ubrk_next (it1)) != UBRK_DONE
|
||||||
&& (pos2 = ubrk_next (it2)) != UBRK_DONE)
|
&& (pos2 = ubrk_next (it2)) != UBRK_DONE)
|
||||||
|
{
|
||||||
|
if (sd->priv->collator)
|
||||||
{
|
{
|
||||||
if (!ucol_strcoll (sd->priv->collator, uc1, pos1, uc2, pos2))
|
if (!ucol_strcoll (sd->priv->collator, uc1, pos1, uc2, pos2))
|
||||||
longest = pos1;
|
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 (it1);
|
||||||
ubrk_close (it2);
|
ubrk_close (it2);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue