Skip to content

Commit fa48ce1

Browse files
committed
Improved retrieve text under cursor for snippets
1 parent b8e68ee commit fa48ce1

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

app/markdowneditor.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -476,9 +476,10 @@ QString MarkdownEditor::textUnderCursor() const
476476
cursor.clearSelection();
477477

478478
// move left until we find a space or reach the start of line
479-
do {
479+
while(!document->characterAt(cursor.position()-1).isSpace() && !cursor.atBlockStart()) {
480480
cursor.movePosition(QTextCursor::Left, QTextCursor::KeepAnchor);
481-
} while(!document->characterAt(cursor.position()-1).isSpace() && !cursor.atBlockStart());
481+
}
482+
482483

483484
return cursor.selectedText();
484485
}

0 commit comments

Comments
 (0)