Bug #414 - Tags filtering not working with unicode characters
- Fixed bug #414, that caused filtering on the presence or absence of tags containing Unicode characters to fail (thanks to Michal Josífko). + + Fixed bug #414, that caused filtering on the presence or absence of tags + containing Unicode characters to fail (thanks to Michal Josífko). ------ old releases ------------------------------
This commit is contained in:
14
src/text.cpp
14
src/text.cpp
@@ -429,13 +429,14 @@ bool isWordStart (const std::string& input, std::string::size_type pos)
|
||||
if (input.length () == 0)
|
||||
return false;
|
||||
|
||||
// If pos is the first alphanumeric character of the string.
|
||||
if (pos == 0 && isalnum (input[pos]))
|
||||
// If pos is the first non space/punct character of the string.
|
||||
if (pos == 0 && !isspace (input[pos]) && !ispunct (input[pos]))
|
||||
return true;
|
||||
|
||||
// If pos is not the first alphanumeric character, but there is a preceding
|
||||
// non-alphanumeric character.
|
||||
if (pos > 0 && isalnum (input[pos]) && !isalnum (input[pos - 1]))
|
||||
// space/punct character.
|
||||
if (pos > 0 && !isspace (input[pos]) && !ispunct (input[pos])
|
||||
&& (isspace (input[pos - 1]) || ispunct (input[pos - 1])))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
@@ -451,12 +452,13 @@ bool isWordEnd (const std::string& input, std::string::size_type pos)
|
||||
return false;
|
||||
|
||||
// If pos is the last alphanumeric character of the string.
|
||||
if (pos == input.length () - 1 && isalnum (input[pos]))
|
||||
if (pos == input.length () - 1 && !isspace (input[pos]) && !ispunct (input[pos]))
|
||||
return true;
|
||||
|
||||
// If pos is not the last alphanumeric character, but there is a following
|
||||
// non-alphanumeric character.
|
||||
if (pos < input.length () - 1 && isalnum (input[pos]) && !isalnum (input[pos + 1]))
|
||||
if (pos < input.length () - 1 && !isspace (input[pos]) && !ispunct (input[pos])
|
||||
&& (isspace (input[pos + 1]) || ispunct (input[pos + 1])))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user