diff --git a/tests/t1330-ls-highlighting.sh b/tests/t1330-ls-highlighting.sh index c3c3558..2cf61a2 100755 --- a/tests/t1330-ls-highlighting.sh +++ b/tests/t1330-ls-highlighting.sh @@ -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 <>> todo.sh -a do 2 +2 x 2009-02-13 remove1 +TODO: 2 marked as done. + +>>> todo.sh list +1 (A) smell the uppercase Roses +flowers @outside +3 notice the sunflowers +4 remove2 +5 stop +2 x 2009-02-13 remove1 +-- +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 (A) smell the uppercase Roses +flowers @outside +3 notice the sunflowers +5 stop +2 x 2009-02-13 remove1 +4 x 2009-02-13 remove2 +-- +TODO: 5 of 5 tasks shown +EOF + test_done diff --git a/todo.cfg b/todo.cfg index 8d1ecb1..b346f7e 100644 --- a/todo.cfg +++ b/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 diff --git a/todo.sh b/todo.sh index 8bbeea1..22eb642 100755 --- a/todo.sh +++ b/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 ) {