mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-23 14:36:44 +02:00
Bug #990
- Precise in the documentation that the wildcards for color precedence must terminate with a dot. If not, 'tag' is completed as 'tagged', which violates the default precedence rule. - Change default precedence rule to reflect this. - Unit test. - ChangeLog and AUTHORS file updated.
This commit is contained in:
parent
90c420263c
commit
7a8e292fe8
6 changed files with 86 additions and 22 deletions
1
AUTHORS
1
AUTHORS
|
@ -138,4 +138,5 @@ suggestions:
|
||||||
Andy Spiegl
|
Andy Spiegl
|
||||||
Ethan Schoonover
|
Ethan Schoonover
|
||||||
Paul Kishimoto
|
Paul Kishimoto
|
||||||
|
Jeff Schroeder
|
||||||
|
|
||||||
|
|
|
@ -69,6 +69,8 @@ Bugs
|
||||||
+ Fixed incorrect Lua API return value (thanks to Oleksii Tsai).
|
+ Fixed incorrect Lua API return value (thanks to Oleksii Tsai).
|
||||||
+ Fixed bug #956, which prevents 'ids', 'uuids' and helper commands to be used
|
+ Fixed bug #956, which prevents 'ids', 'uuids' and helper commands to be used
|
||||||
directly by external script when a variable is override.
|
directly by external script when a variable is override.
|
||||||
|
+ Fixed bug #990, which prevents color precedence to be applied correctly for
|
||||||
|
tagged tasks.
|
||||||
|
|
||||||
------ old releases ------------------------------
|
------ old releases ------------------------------
|
||||||
|
|
||||||
|
|
|
@ -243,12 +243,12 @@ be a visual mess. Beware!
|
||||||
The precedence for the color rules is determined by the configuration
|
The precedence for the color rules is determined by the configuration
|
||||||
variable 'rule.precedence.color', which by default contains:
|
variable 'rule.precedence.color', which by default contains:
|
||||||
|
|
||||||
due.today,active,blocked,overdue,due,keyword,project,tag,recurring,pri,tagged,completed,deleted
|
due.today,active,blocked,overdue,due,keyword.,project.,tag.,recurring,pri.,tagged,completed,deleted
|
||||||
|
|
||||||
These are just the color rules with the 'color.' prefix removed. The
|
These are just the color rules with the 'color.' prefix removed. The
|
||||||
rule 'color.due.today' is the highest precedence, and 'color.deleted' is the lowest.
|
rule 'color.due.today' is the highest precedence, and 'color.deleted' is the lowest.
|
||||||
|
|
||||||
The keyword rule shown here as 'keyword' corresponds to a wildcard pattern,
|
The keyword rule shown here as 'keyword.' corresponds to a wildcard pattern,
|
||||||
meaning 'color.keyword.*', or in other words all the keyword rules. Similarly
|
meaning 'color.keyword.*', or in other words all the keyword rules. Similarly
|
||||||
for the 'color.tag.*' and 'color.project.*' rules.
|
for the 'color.tag.*' and 'color.project.*' rules.
|
||||||
|
|
||||||
|
|
|
@ -265,7 +265,7 @@ std::string Config::_defaults =
|
||||||
"# Here is the rule precedence order, highest to lowest.\n"
|
"# Here is the rule precedence order, highest to lowest.\n"
|
||||||
"# Note that these are just the color rule names, without the leading 'color.'\n"
|
"# Note that these are just the color rule names, without the leading 'color.'\n"
|
||||||
"# and any trailing '.value'.\n"
|
"# and any trailing '.value'.\n"
|
||||||
"rule.precedence.color=due.today,active,blocked,overdue,due,scheduled,keyword,project,tag,recurring,pri,tagged,completed,deleted\n"
|
"rule.precedence.color=due.today,active,blocked,overdue,due,scheduled,keyword.,project.,tag.,recurring,pri.,tagged,completed,deleted\n"
|
||||||
"\n"
|
"\n"
|
||||||
"# Shadow file support\n"
|
"# Shadow file support\n"
|
||||||
"#shadow.file=/tmp/shadow.txt # Location of shadow file\n"
|
"#shadow.file=/tmp/shadow.txt # Location of shadow file\n"
|
||||||
|
|
|
@ -314,27 +314,27 @@ void autoColorize (Task& task, Color& c)
|
||||||
std::vector <std::string>::reverse_iterator r;
|
std::vector <std::string>::reverse_iterator r;
|
||||||
for (r = gsPrecedence.rbegin (); r != gsPrecedence.rend (); ++r)
|
for (r = gsPrecedence.rbegin (); r != gsPrecedence.rend (); ++r)
|
||||||
{
|
{
|
||||||
if (*r == "color.blocked") colorizeBlocked (task, *r, c);
|
if (*r == "color.blocked") colorizeBlocked (task, *r, c);
|
||||||
else if (*r == "color.tagged") colorizeTagged (task, *r, c);
|
else if (*r == "color.tagged") colorizeTagged (task, *r, c);
|
||||||
else if (*r == "color.pri.L") colorizePriorityL (task, *r, c);
|
else if (*r == "color.pri.L") colorizePriorityL (task, *r, c);
|
||||||
else if (*r == "color.pri.M") colorizePriorityM (task, *r, c);
|
else if (*r == "color.pri.M") colorizePriorityM (task, *r, c);
|
||||||
else if (*r == "color.pri.H") colorizePriorityH (task, *r, c);
|
else if (*r == "color.pri.H") colorizePriorityH (task, *r, c);
|
||||||
else if (*r == "color.pri.none") colorizePriorityNone (task, *r, c);
|
else if (*r == "color.pri.none") colorizePriorityNone (task, *r, c);
|
||||||
else if (*r == "color.active") colorizeActive (task, *r, c);
|
else if (*r == "color.active") colorizeActive (task, *r, c);
|
||||||
else if (*r == "color.scheduled") colorizeScheduled (task, *r, c);
|
else if (*r == "color.scheduled") colorizeScheduled (task, *r, c);
|
||||||
else if (*r == "color.project.none") colorizeProjectNone (task, *r, c);
|
else if (*r == "color.project.none") colorizeProjectNone (task, *r, c);
|
||||||
else if (*r == "color.tag.none") colorizeTagNone (task, *r, c);
|
else if (*r == "color.tag.none") colorizeTagNone (task, *r, c);
|
||||||
else if (*r == "color.due") colorizeDue (task, *r, c);
|
else if (*r == "color.due") colorizeDue (task, *r, c);
|
||||||
else if (*r == "color.due.today") colorizeDueToday (task, *r, c);
|
else if (*r == "color.due.today") colorizeDueToday (task, *r, c);
|
||||||
else if (*r == "color.overdue") colorizeOverdue (task, *r, c);
|
else if (*r == "color.overdue") colorizeOverdue (task, *r, c);
|
||||||
else if (*r == "color.recurring") colorizeRecurring (task, *r, c);
|
else if (*r == "color.recurring") colorizeRecurring (task, *r, c);
|
||||||
else if (*r == "color.completed") colorizeCompleted (task, *r, c);
|
else if (*r == "color.completed") colorizeCompleted (task, *r, c);
|
||||||
else if (*r == "color.deleted") colorizeDeleted (task, *r, c);
|
else if (*r == "color.deleted") colorizeDeleted (task, *r, c);
|
||||||
|
|
||||||
// Wildcards
|
// Wildcards
|
||||||
else if (r->substr (0, 9) == "color.tag") colorizeTag (task, *r, c);
|
else if (r->substr (0, 10) == "color.tag.") colorizeTag (task, *r, c);
|
||||||
else if (r->substr (0, 13) == "color.project") colorizeProject (task, *r, c);
|
else if (r->substr (0, 14) == "color.project.") colorizeProject (task, *r, c);
|
||||||
else if (r->substr (0, 13) == "color.keyword") colorizeKeyword (task, *r, c);
|
else if (r->substr (0, 14) == "color.keyword.") colorizeKeyword (task, *r, c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
61
test/bug.990.t
Executable file
61
test/bug.990.t
Executable file
|
@ -0,0 +1,61 @@
|
||||||
|
#! /usr/bin/perl
|
||||||
|
################################################################################
|
||||||
|
## taskwarrior - a command line task list manager.
|
||||||
|
##
|
||||||
|
## Copyright 2006-2012, Paul Beckingham, Federico Hernandez.
|
||||||
|
##
|
||||||
|
## Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
## of this software and associated documentation files (the "Software"), to deal
|
||||||
|
## in the Software without restriction, including without limitation the rights
|
||||||
|
## to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
## copies of the Software, and to permit persons to whom the Software is
|
||||||
|
## furnished to do so, subject to the following conditions:
|
||||||
|
##
|
||||||
|
## The above copyright notice and this permission notice shall be included
|
||||||
|
## in all copies or substantial portions of the Software.
|
||||||
|
##
|
||||||
|
## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||||
|
## OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
## FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||||
|
## THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
## LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
## OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
## SOFTWARE.
|
||||||
|
##
|
||||||
|
## http://www.opensource.org/licenses/mit-license.php
|
||||||
|
##
|
||||||
|
################################################################################
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
use Test::More tests => 3;
|
||||||
|
|
||||||
|
# Create the rc file.
|
||||||
|
if (open my $fh, '>', 'color.rc')
|
||||||
|
{
|
||||||
|
print $fh "data.location=.\n",
|
||||||
|
"color.pri.L=green\n",
|
||||||
|
"color.tagged=red\n",
|
||||||
|
"_forcecolor=1\n";
|
||||||
|
close $fh;
|
||||||
|
ok (-r 'color.rc', 'Created color.rc');
|
||||||
|
}
|
||||||
|
|
||||||
|
# Bug that colored any task with both priority:L and a tag as though
|
||||||
|
# rc.color.tagged had a higher precedence than rc.color.pri.L, which it is not.
|
||||||
|
|
||||||
|
qx{../src/task rc:color.rc add test +test pri:L};
|
||||||
|
my $output = qx{../src/task rc:color.rc list};
|
||||||
|
like ($output, qr/ \033\[32m .* test .* \033\[0m /x, 'Colored with the priority color, which has precedence over the tagged color');
|
||||||
|
|
||||||
|
# Cleanup.
|
||||||
|
unlink qw(pending.data completed.data undo.data backlog.data synch.key color.rc);
|
||||||
|
ok (! -r 'pending.data' &&
|
||||||
|
! -r 'completed.data' &&
|
||||||
|
! -r 'undo.data' &&
|
||||||
|
! -r 'backlog.data' &&
|
||||||
|
! -r 'synch.key' &&
|
||||||
|
! -r 'color.rc', 'Cleanup');
|
||||||
|
|
||||||
|
exit 0;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue