CppEditor: Avoid auto insertion of '}' in empty line

...when typing '{'.

Change-Id: Ia1d3bcd7440c96ed3c8c1479148dd74d3d291689
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Nikolai Kosjar
2017-07-14 12:38:06 +02:00
parent be2b3c91ae
commit be3e12c8af

View File

@@ -143,9 +143,13 @@ bool MatchingText::contextAllowsAutoParentheses(const QTextCursor &cursor,
if (!textToInsert.isEmpty())
ch = textToInsert.at(0);
if (ch == QLatin1Char('{') && cursor.block().text().trimmed().isEmpty())
return false; // User just might want to wrap up some lines.
if (!shouldInsertMatchingText(cursor) && ch != QLatin1Char('\'') && ch != QLatin1Char('"'))
return false;
else if (isInCommentHelper(cursor))
if (isInCommentHelper(cursor))
return false;
return true;