From 1acdd4a6e035600d389416da05a3680468ded41a Mon Sep 17 00:00:00 2001 From: spatten Date: Tue, 24 Dec 2024 11:43:39 -0800 Subject: [PATCH 1/3] make the test break --- src/test/fixtures/sortable-sorted.md | 4 ++-- src/test/fixtures/sortable.md | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/test/fixtures/sortable-sorted.md b/src/test/fixtures/sortable-sorted.md index 113dc7d..68826f5 100644 --- a/src/test/fixtures/sortable-sorted.md +++ b/src/test/fixtures/sortable-sorted.md @@ -1,5 +1,3 @@ -# TODO foo and bar -this is some stufff # TODO whee and yeah ## DONE @@ -7,6 +5,8 @@ I should be left under whee! # nothing at all to see here # TODO and here -- last non-done-line should be here, line 14 +# 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..7ebcfce 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 From 0b725fb24cdec101a6b3aa24c4b1c6da1d4acb21 Mon Sep 17 00:00:00 2001 From: spatten Date: Tue, 24 Dec 2024 11:52:49 -0800 Subject: [PATCH 2/3] check for null or undefined --- src/extension.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; From 2a666ac1752c709dd5f94d6f255916d8cf4d94a4 Mon Sep 17 00:00:00 2001 From: spatten Date: Tue, 24 Dec 2024 11:55:01 -0800 Subject: [PATCH 3/3] fix the tests on the fixtures --- src/test/fixtures/sortable-sorted.md | 2 +- src/test/fixtures/sortable.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/test/fixtures/sortable-sorted.md b/src/test/fixtures/sortable-sorted.md index 68826f5..7a1b1d4 100644 --- a/src/test/fixtures/sortable-sorted.md +++ b/src/test/fixtures/sortable-sorted.md @@ -4,7 +4,7 @@ and yeah 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) diff --git a/src/test/fixtures/sortable.md b/src/test/fixtures/sortable.md index 7ebcfce..68bb5aa 100644 --- a/src/test/fixtures/sortable.md +++ b/src/test/fixtures/sortable.md @@ -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)