From 67775586464db3a454149a8da2ef5b86eb97ebb4 Mon Sep 17 00:00:00 2001 From: fretep Date: Wed, 20 Sep 2017 22:21:34 +1000 Subject: [PATCH] Fix case sensitivity folding complete tasks --- ftplugin/todo.vim | 2 +- tests/todo.vader | 31 +++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/ftplugin/todo.vim b/ftplugin/todo.vim index c270b47..19f551b 100644 --- a/ftplugin/todo.vim +++ b/ftplugin/todo.vim @@ -91,7 +91,7 @@ function! TodoFoldLevel(lnum) " function we will return 1 for the completed tasks (they will be at the " first folding level) while for the other lines 0 will be returned, " indicating that they do not fold. - return match(getline(a:lnum),'^[xX]\s.\+$') + 1 + return match(getline(a:lnum),'\C^x\s') + 1 endfunction " TodoFoldText() {{{2 diff --git a/tests/todo.vader b/tests/todo.vader index 290addf..953fce0 100644 --- a/tests/todo.vader +++ b/tests/todo.vader @@ -743,4 +743,35 @@ Then (Is cursor on first non-overdue task?): After: unlet g:TodoTxtSortDueDateCursorPos +" file: ftplugin/todo.vim {{{1 + +" function: TodoFoldLevel(lnum) {{{2 + +Given todo (Tasks): + active due:2050-01-01 task L:01 + x 2017-09-01 complete task 1 L:02 + x 2017-09-01 complete task 2 L:03 + x 2017-09-01 complete task 3 L:04 + X 2017-09-01 complete task 3 L:05 + active due:2055-01-01 L:06 + x 2017-09-01 complete task 4 L:07 + active due:2059-01-01 L:08 + xinvalid due:2059-01-01 L:09 + Xinvalid due:2059-01-01 L:10 + active due:2059-01-01 L:11 +Execute (Check folding): + AssertEqual TodoFoldLevel(1), 0 + AssertEqual TodoFoldLevel(2), 1 + AssertEqual TodoFoldLevel(3), 1 + AssertEqual TodoFoldLevel(4), 1 + AssertEqual TodoFoldLevel(5), 0 + AssertEqual TodoFoldLevel(6), 0 + AssertEqual TodoFoldLevel(7), 1 + AssertEqual TodoFoldLevel(8), 0 + AssertEqual TodoFoldLevel(9), 0 + AssertEqual TodoFoldLevel(10), 0 + AssertEqual TodoFoldLevel(11), 0 + +"}}} + " vim: tabstop=2 shiftwidth=2 softtabstop=2 expandtab foldmethod=marker