Skip to content

Commit 018f10e

Browse files
committed
comment: Clean up code and add an explanatory comment
1 parent 6cb5da2 commit 018f10e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/Commands/ToggleDone.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,10 @@ export const toggleDone = (checking: boolean, editor: Editor, view: MarkdownView
4242
if (replacementTextIsNonEmpty || taskIsOnLastLine) {
4343
editor.setLine(lineNumber, insertion.text);
4444
} else {
45+
// The replacement text is empty, and our line was followed by a new line character,
46+
// so we delete the line and the new-line, to avoid leaving a blank line in the file.
4547
const from = { line: lineNumber, ch: 0 };
4648
const to = { line: lineNumber + 1, ch: 0 };
47-
// console.log(`Deleting line+EOL "${editor.getRange(from, to)}", because insertion.text is empty.`);
4849
editor.replaceRange('', from, to);
4950
}
5051

0 commit comments

Comments
 (0)