Fix substitution for hiding contexts/projects

When using the -+ or -@ option to hide project or context names in list
output, the color reset sequence was being deleted if the project/context
was at the end of the line.

For example, with the following tasks:

    (B) with priority, ending in a +project
    task that shouldn't be highlighted

Running 'todo.sh -+ list' would hide the "+project" from the first task,
but would also remove the color reset sequence ^[[0m at the end.  The
color from the prioritized task would continue to the next lines.

This commit fixes the problem and adds a test to verify the fix.
This commit is contained in:
Nick Wilson
2011-01-23 15:40:13 -08:00
parent 82c8349499
commit f1d339a537
2 changed files with 20 additions and 2 deletions

View File

@@ -360,7 +360,7 @@ do
unset HIDE_CONTEXTS_SUBSTITUTION
else
## One or odd value -- hide context names
export HIDE_CONTEXTS_SUBSTITUTION='[[:space:]]@[^[:space:]]\{1,\}'
export HIDE_CONTEXTS_SUBSTITUTION='[[:space:]]@[[:graph:]]\{1,\}'
fi
;;
'+' )
@@ -376,7 +376,7 @@ do
unset HIDE_PROJECTS_SUBSTITUTION
else
## One or odd value -- hide project names
export HIDE_PROJECTS_SUBSTITUTION='[[:space:]][+][^[:space:]]\{1,\}'
export HIDE_PROJECTS_SUBSTITUTION='[[:space:]][+][[:graph:]]\{1,\}'
fi
;;
a )