diff --git a/tests/t1300-ls.sh b/tests/t1300-ls.sh index c978a08..e279e74 100755 --- a/tests/t1300-ls.sh +++ b/tests/t1300-ls.sh @@ -539,4 +539,85 @@ test_todo_session 'check line number padding, out to 3 digits' < todo.txt <>> todo.sh ls +1 hex00 this is one line +3 hex02 this is another line +4 hex03 this is another line +5 hex04 this is another line +6 hex05 this is another line +7 hex06 this is another line +8 hex07 this is another line +-- +TODO: 7 of 7 tasks shown from $HOME/todo.txt +EOF + +# More than 10 +cat > todo.txt <>> todo.sh ls +01 hex00 this is one line +03 hex02 this is another line +04 hex03 this is another line +05 hex04 this is another line +06 hex05 this is another line +07 hex06 this is another line +08 hex07 this is another line +09 hex08 this is another line +10 hex09 this is another line +-- +TODO: 9 of 9 tasks shown from $HOME/todo.txt +EOF +cat > todo.txt <>> todo.sh ls +01 hex00 this is one line +03 hex02 this is another line +04 hex03 this is another line +05 hex04 this is another line +06 hex05 this is another line +08 hex07 this is another line +09 hex08 this is another line +10 hex09 this is another line +-- +TODO: 8 of 8 tasks shown from $HOME/todo.txt +EOF + test_done diff --git a/todo.sh b/todo.sh index cbc4e34..980283e 100755 --- a/todo.sh +++ b/todo.sh @@ -531,7 +531,7 @@ _list() { items=$( sed = "$src" \ | sed "N; s/^/ /; s/ *\(.\{$PADDING,\}\)\n/\1 /" \ - | grep -v "^[0-9]\+ *$" + | grep -v "^[ 0-9]\+ *$" ) if [ "${filter_command}" ]; then filtered_items=$(echo -ne "$items" | eval ${filter_command})