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:
Paul Beckingham 2010-06-20 20:10:20 -04:00
parent 916b8641b3
commit 99bce308e6
5 changed files with 86 additions and 8 deletions

View file

@ -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;