Skip to content

Commit b363564

Browse files
committed
Fix: command to insert subtask creates it in the next new line when cursor is not at a blank line or not at the first position of line
1 parent 5c4d0ac commit b363564

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/main.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,8 @@ export default class TimeTreePlugin extends Plugin {
182182

183183
async insertNewTask(editor: Editor): Promise<void> {
184184
let cursor = editor.getCursor();
185-
if (cursor.ch !== 0) {
186-
const currentLineText = editor.getLine(cursor.line);
185+
const currentLineText = editor.getLine(cursor.line);
186+
if (currentLineText.trim() !== "" || cursor.ch !== 0) {
187187
editor.replaceRange("\n", {
188188
line: cursor.line,
189189
ch: currentLineText.length,

0 commit comments

Comments
 (0)