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:
4
todo.sh
4
todo.sh
@@ -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 )
|
||||
|
||||
Reference in New Issue
Block a user