BUG: interpretation of \033 escape sequences in task

The global substitution in the AWK highlighting of prioritized and done tasks also affected the task text itself, not just the inserted color definitions.
Factored out the evaluation of the color variables and interpretation of \033 into a highlight() AWK function.
Added test cases which check that \a, \t, \n, \x.. and \0.. escape characters in the task text are listed as-is, without interpretation.
This commit is contained in:
Ingo Karkat
2010-10-21 11:30:31 +02:00
parent 824101defd
commit ce501c5362
2 changed files with 52 additions and 11 deletions

View File

@@ -7,6 +7,10 @@ This test checks listing of tasks that have embedded escape sequences in them.
'
. ./test-lib.sh
# Note: The quadrupled escaped backslashes (even 8-fold for the escape color
# code) in the expected output are necessary due to (superfluous?!)
# interpretation of the expected output in the test library itself.
#
# check aborted list output on \c escape sequence
#
@@ -30,4 +34,36 @@ TODO: 3 of 3 tasks shown
TODO: 1 of 3 tasks shown
EOF
#
# check various escape sequences
#
cat > todo.txt <<'EOF'
first todo with \\, \a and \t
second todo with \r\n line break
third todo with \x42\x55\x47 and \033[0;31m color codes \033[0;30m
EOF
test_todo_session 'various escape sequences' <<'EOF'
>>> todo.sh ls
1 first todo with \\\\\\\\, \\\\a and \\\\t
2 second todo with \\\\r\\\\n line break
3 third todo with \\\\x42\\\\x55\\\\x47 and \\\\\\\\033[0;31m color codes \\\\\\\\033[0;30m
--
TODO: 3 of 3 tasks shown
EOF
#
# check embedding of actual color sequence
#
cat > todo.txt <<'EOF'
A task with  actual color 
EOF
test_todo_session 'embedding of actual color sequence' <<'EOF'
>>> todo.sh ls
1 A task with  actual color 
--
TODO: 1 of 1 tasks shown
EOF
test_done