diff --git a/AUTHORS b/AUTHORS index 06a2c1ce8..11bc443a1 100644 --- a/AUTHORS +++ b/AUTHORS @@ -22,6 +22,7 @@ The following submitted code, packages or analysis, and deserve special thanks: Alexander Neumann Emil Sköldberg Johannes Schlatow + Michal Josífko Thanks to the following, who submitted detailed bug reports and excellent suggestions: Eugene Kramer diff --git a/ChangeLog b/ChangeLog index a741fc5e2..0b6ce8007 100644 --- a/ChangeLog +++ b/ChangeLog @@ -32,6 +32,8 @@ + Fixed bug #211 - it was unclear which commands modify a task description. + Fixed bug #411, clarifying that the 'projects' command only lists projects for which there are pending tasks (thanks to Dirk Deimeke). + + 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 ------------------------------ diff --git a/src/import.cpp b/src/import.cpp index 4c453eefc..03f192b37 100644 --- a/src/import.cpp +++ b/src/import.cpp @@ -127,13 +127,13 @@ static fileType determineFileType (const std::vector & lines) // +project if (words[w].length () > 1 && words[w][0] == '+' && - isalnum (words[w][1])) + !isspace (words[w][1])) return todo_sh_2_0; // @context if (words[w].length () > 1 && words[w][0] == '@' && - isalnum (words[w][1])) + !isspace (words[w][1])) return todo_sh_2_0; } } diff --git a/src/tests/bug.414.t b/src/tests/bug.414.t new file mode 100755 index 000000000..3305a39d6 --- /dev/null +++ b/src/tests/bug.414.t @@ -0,0 +1,73 @@ +#! /usr/bin/perl +################################################################################ +## task - a command line task list manager. +## +## Copyright 2006 - 2010, Paul Beckingham. +## All rights reserved. +## +## This program is free software; you can redistribute it and/or modify it under +## the terms of the GNU General Public License as published by the Free Software +## Foundation; either version 2 of the License, or (at your option) any later +## version. +## +## This program is distributed in the hope that it will be useful, but WITHOUT +## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +## FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +## details. +## +## You should have received a copy of the GNU General Public License along with +## this program; if not, write to the +## +## Free Software Foundation, Inc., +## 51 Franklin Street, Fifth Floor, +## Boston, MA +## 02110-1301 +## USA +## +################################################################################ + +use strict; +use warnings; +use Test::More tests => 9; + +# Create the rc file. +if (open my $fh, '>', 'bug.rc') +{ + print $fh "data.location=.\n"; + close $fh; + ok (-r 'bug.rc', 'Created bug.rc'); +} + +# Bug #414: Tags filtering not working with unicode characters + +# Add a task with a UTF-8 tag. +qx{../task rc:bug.rc add one +osobní}; +my $output = qx{../task rc:bug.rc ls +osobní}; +like ($output, qr/one/, 'found UTF8 tag osobní'); + +$output = qx{../task rc:bug.rc ls -osobní}; +unlike ($output, qr/one/, 'not found UTF8 tag osobní'); + +# And a different one +qx{../task rc:bug.rc add two +föo}; +$output = qx{../task rc:bug.rc ls +föo}; +like ($output, qr/two/, 'found UTF8 tag föo'); + +$output = qx{../task rc:bug.rc ls -föo}; +unlike ($output, qr/two/, 'not found UTF8 tag föo'); + +# Cleanup. +unlink 'pending.data'; +ok (!-r 'pending.data', 'Removed pending.data'); + +unlink 'completed.data'; +ok (!-r 'completed.data', 'Removed completed.data'); + +unlink 'undo.data'; +ok (!-r 'undo.data', 'Removed undo.data'); + +unlink 'bug.rc'; +ok (!-r 'bug.rc', 'Removed bug.rc'); + +exit 0; + diff --git a/src/text.cpp b/src/text.cpp index 0ca9aeb37..9116a5a95 100644 --- a/src/text.cpp +++ b/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;