Skip to content

Commit 6806483

Browse files
committed
refactor: . Merge if statements
1 parent 854d9be commit 6806483

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

src/Commands/ToggleDone.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,7 @@ export const toggleDone = (checking: boolean, editor: Editor, view: MarkdownView
4040
const replacementTextIsNonEmpty = insertion.text.length > 0;
4141
const taskWasNotOnLastLine = lineNumber < editor.lineCount() - 1;
4242
const taskIsOnLastLine = !taskWasNotOnLastLine;
43-
if (replacementTextIsNonEmpty) {
44-
editor.setLine(lineNumber, insertion.text);
45-
} else if (taskIsOnLastLine) {
46-
// https://github.com/obsidian-tasks-group/obsidian-tasks/issues/3342
47-
// There is no end-of-line character on our line, which is the last line in the file.
48-
// console.log(`Deleting line "${editor.getLine(lineNumber)}", because insertion.text is empty.`);
43+
if (replacementTextIsNonEmpty || taskIsOnLastLine) {
4944
editor.setLine(lineNumber, insertion.text);
5045
} else {
5146
const from = { line: lineNumber, ch: 0 };

0 commit comments

Comments
 (0)