Commit 23a5f173 authored by Roberto Raggi's avatar Roberto Raggi
Browse files

Check the traling text before inserting closing braces.

parent 2bbc9643
......@@ -1684,8 +1684,15 @@ static bool shouldInsertNewline(const QTextCursor &tc)
QString QmlJSTextEditor::insertParagraphSeparator(const QTextCursor &tc) const
if (shouldInsertNewline(tc))
if (shouldInsertNewline(tc)) {
QTextCursor cursor = tc;
cursor.movePosition(QTextCursor::EndOfBlock, QTextCursor::KeepAnchor);
if (! cursor.selectedText().trimmed().isEmpty())
return QString();
return QLatin1String("}\n");
return QLatin1String("}");
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment