ENH: Added highlighting of done (but not yet archived) tasks.
This makes done tasks more stand out (like prioritized tasks) in the task list. Default highlighting is LIGHT_GREY, which seems to be modest and go well with the assumed dark terminal background.
Reintroduced the OSX-compatible sed filter that was introduced by commit 8b7e2e6aad and superseded by the PRI_X coloring generalization.
This commit is contained in:
@@ -111,4 +111,41 @@ test_todo_session 'different highlighting for pri X' <<'EOF'
|
||||
TODO: 8 of 8 tasks shown
|
||||
EOF
|
||||
|
||||
# check highlighting of done (but not yet archived) tasks
|
||||
#
|
||||
cat > todo.txt <<EOF
|
||||
(A) smell the uppercase Roses +flowers @outside
|
||||
remove1
|
||||
notice the sunflowers
|
||||
remove2
|
||||
stop
|
||||
EOF
|
||||
test_todo_session 'highlighting of done tasks' <<EOF
|
||||
>>> todo.sh -a do 2
|
||||
2 x 2009-02-13 remove1
|
||||
TODO: 2 marked as done.
|
||||
|
||||
>>> todo.sh list
|
||||
[1;33m1 (A) smell the uppercase Roses +flowers @outside[0m
|
||||
3 notice the sunflowers
|
||||
4 remove2
|
||||
5 stop
|
||||
[0;37m2 x 2009-02-13 remove1[0m
|
||||
--
|
||||
TODO: 5 of 5 tasks shown
|
||||
|
||||
>>> todo.sh -a do 4
|
||||
4 x 2009-02-13 remove2
|
||||
TODO: 4 marked as done.
|
||||
|
||||
>>> todo.sh list
|
||||
[1;33m1 (A) smell the uppercase Roses +flowers @outside[0m
|
||||
3 notice the sunflowers
|
||||
5 stop
|
||||
[0;37m2 x 2009-02-13 remove1[0m
|
||||
[0;37m4 x 2009-02-13 remove2[0m
|
||||
--
|
||||
TODO: 5 of 5 tasks shown
|
||||
EOF
|
||||
|
||||
test_done
|
||||
|
||||
16
todo.cfg
16
todo.cfg
@@ -38,18 +38,26 @@ export TMP_FILE="$TODO_DIR/todo.tmp"
|
||||
# export WHITE='\\033[1;37m'
|
||||
# export DEFAULT='\\033[0m'
|
||||
|
||||
# === PRIORITY COLORS ===
|
||||
# === COLORS ===
|
||||
|
||||
## Priorities can be any upper-case letter.
|
||||
## A,B,C are highlighted; you can add coloring for more.
|
||||
## Uncomment and edit to override these defaults.
|
||||
|
||||
## Reference the constants from the color map above,
|
||||
## or use $NONE to disable highlighting.
|
||||
#
|
||||
# Priorities can be any upper-case letter.
|
||||
# A,B,C are highlighted; you can add coloring for more.
|
||||
#
|
||||
# export PRI_A=$YELLOW # color for A priority
|
||||
# export PRI_B=$GREEN # color for B priority
|
||||
# export PRI_C=$LIGHT_BLUE # color for C priority
|
||||
# export PRI_D=... # define your own
|
||||
# export PRI_X=$WHITE # color unless explicitly defined
|
||||
|
||||
# There is highlighting for tasks that have been done,
|
||||
# but haven't been archived yet.
|
||||
#
|
||||
# export COLOR_DONE=$LIGHT_GREY
|
||||
|
||||
# === BEHAVIOR ===
|
||||
|
||||
## customize list output
|
||||
|
||||
7
todo.sh
7
todo.sh
@@ -470,6 +470,9 @@ export PRI_B=$GREEN # color for B priority
|
||||
export PRI_C=$LIGHT_BLUE # color for C priority
|
||||
export PRI_X=$WHITE # color for rest of them
|
||||
|
||||
# Default highlight colors.
|
||||
export COLOR_DONE=$LIGHT_GREY # color for done (but not yet archived) tasks
|
||||
|
||||
# Default sentence delimiters for todo.sh append.
|
||||
# If the text to be appended to the task begins with one of these characters, no
|
||||
# whitespace is inserted in between. This makes appending to an enumeration
|
||||
@@ -531,6 +534,7 @@ if [ $TODOTXT_PLAIN = 1 ]; then
|
||||
done
|
||||
PRI_X=$NONE
|
||||
DEFAULT=$NONE
|
||||
COLOR_DONE=$NONE
|
||||
fi
|
||||
|
||||
_addto() {
|
||||
@@ -632,6 +636,9 @@ _list() {
|
||||
s/^ /0/;
|
||||
''' \
|
||||
| eval ${TODOTXT_SORT_COMMAND} \
|
||||
| sed '''
|
||||
/^[0-9]\{'$PADDING'\} x /s|^.*|'$COLOR_DONE'&'$DEFAULT'|
|
||||
''' \
|
||||
| awk '''{
|
||||
pos = match($0, /\([A-Z]\)/)
|
||||
if( pos > 0 && match($0, /^[0-9]+ x /) != 1 ) {
|
||||
|
||||
Reference in New Issue
Block a user