mirror of
https://github.com/OpenMW/openmw.git
synced 2025-03-27 05:10:26 +00:00
Fixed an issue where keyword search expected the text to be all ASCII characters
This commit is contained in:
parent
e4648cec48
commit
76be2e91e5
1 changed files with 14 additions and 1 deletions
|
@ -68,6 +68,19 @@ public:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool isWhitespaceUTF8(const int utf8Char)
|
||||||
|
{
|
||||||
|
if (utf8Char >= 0 && utf8Char <= UCHAR_MAX)
|
||||||
|
{
|
||||||
|
//That function has undefined behavior if the character doesn't fit in unsigned char
|
||||||
|
return std::isspace(utf8Char);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static bool sortMatches(const Match& left, const Match& right)
|
static bool sortMatches(const Match& left, const Match& right)
|
||||||
{
|
{
|
||||||
return left.mBeg < right.mBeg;
|
return left.mBeg < right.mBeg;
|
||||||
|
@ -83,7 +96,7 @@ public:
|
||||||
{
|
{
|
||||||
Point prev = i;
|
Point prev = i;
|
||||||
--prev;
|
--prev;
|
||||||
if(isalpha(*prev))
|
if(!isWhitespaceUTF8(*prev))
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue