diff --git a/tests/t1330-ls-highlighting.sh b/tests/t1330-ls-highlighting.sh index aa3db44..d5d0f0e 100755 --- a/tests/t1330-ls-highlighting.sh +++ b/tests/t1330-ls-highlighting.sh @@ -166,4 +166,20 @@ test_todo_session 'highlighting with hidden contexts/projects' < todo.txt <>> todo.sh ls +1 (D) some prioritized task +2 not prioritized +3 should not be seen as PRIORITIZE(D) task +-- +TODO: 3 of 3 tasks shown +EOF + test_done diff --git a/todo.sh b/todo.sh index a21356e..04718ca 100755 --- a/todo.sh +++ b/todo.sh @@ -720,11 +720,10 @@ _list() { return color } { - pos = match($0, /\([A-Z]\)/) if (match($0, /^[0-9]+ x /)) { print highlight("COLOR_DONE") $0 highlight("DEFAULT") - } else if (pos > 0) { - clr = highlight("PRI_" substr($0, pos+1, 1)) + } else if (match($0, /^[0-9]+ \([A-Z]\)[[:space:]]/)) { + clr = highlight("PRI_" substr($0, RSTART + RLENGTH - 3, 1)) print ( clr ? clr : highlight("PRI_X") ) $0 highlight("DEFAULT") } else { print } }