diff --git a/src/extension.ts b/src/extension.ts index b3408e5..9444d35 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -349,7 +349,7 @@ const moveDoneToBottom = async function (editor: vscode.TextEditor, params: { mi let doneEntries: [number, number][] = []; headers.forEach((header, n) => { const startLine = header.map?.[0]; - if (!startLine) { + if (startLine === undefined || startLine === null) { return; } let endLine; diff --git a/src/test/fixtures/sortable-sorted.md b/src/test/fixtures/sortable-sorted.md index 113dc7d..7a1b1d4 100644 --- a/src/test/fixtures/sortable-sorted.md +++ b/src/test/fixtures/sortable-sorted.md @@ -1,12 +1,12 @@ -# TODO foo and bar -this is some stufff # TODO whee and yeah ## DONE I should be left under whee! # nothing at all to see here -# TODO and here -- last non-done-line should be here, line 14 +# TODO and here -- last non-done-line should be here, line 7 +# DONE foo and bar +this is some stufff # DONE nice (2,3) and stuff # DONE foo (6,6) diff --git a/src/test/fixtures/sortable.md b/src/test/fixtures/sortable.md index 24de340..68bb5aa 100644 --- a/src/test/fixtures/sortable.md +++ b/src/test/fixtures/sortable.md @@ -1,4 +1,4 @@ -# TODO foo and bar +# DONE foo and bar this is some stufff # DONE nice (2,3) and stuff @@ -12,5 +12,5 @@ and whatever yeah # nothing at all to see here # DONE bar (9, 9) -# TODO and here -- last non-done-line should be here, line 14 +# TODO and here -- last non-done-line should be here, line 7 # DONE baz (11, 12)