BUG: Pattern "(X)" anywhere highlighted as prioritized.

According to the "Todo.txt Format" specs, "Rule 1: If a priority exists, it ALWAYS appears first."

Adapt AWK filtering to match priorities only directly after the task number added by the _list processing, and also matching the required trailing space.
This commit is contained in:
Ingo Karkat
2011-09-23 15:40:23 +02:00
parent 72fe73f3d8
commit 99fa15da36
2 changed files with 18 additions and 3 deletions

View File

@@ -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 }
}