forked from qt-creator/qt-creator
C++: Lambda formatting issues.
Fix code formatting in cases when '{' and '}' appear within expression
context (ex. lambda expression, initializer lists).
Change-Id: I42b28170a8d6d5fd08a9a1a8d8e7698219c18966
Reviewed-by: Erik Verbruggen <erik.verbruggen@nokia.com>
This commit is contained in:
committed by
Erik Verbruggen
parent
48b4abe877
commit
4ca6c51c7f
@@ -276,10 +276,12 @@ int AutoCompleter::paragraphSeparatorAboutToBeInserted(QTextCursor &cursor,
|
||||
return 0;
|
||||
|
||||
// verify that we indeed do have an extra opening brace in the document
|
||||
QTextBlock block = cursor.block();
|
||||
const QString textFromCusror = block.text().mid(cursor.positionInBlock()).trimmed();
|
||||
int braceDepth = BaseTextDocumentLayout::braceDepth(doc->lastBlock());
|
||||
|
||||
if (braceDepth <= 0)
|
||||
return 0; // braces are all balanced or worse, no need to do anything
|
||||
if (braceDepth <= 0 && (textFromCusror.isEmpty() || textFromCusror.at(0) != QLatin1Char('}')))
|
||||
return 0; // braces are all balanced or worse, no need to do anything and separator inserted not between '{' and '}'
|
||||
|
||||
// we have an extra brace , let's see if we should close it
|
||||
|
||||
@@ -289,7 +291,6 @@ int AutoCompleter::paragraphSeparatorAboutToBeInserted(QTextCursor &cursor,
|
||||
if (condition) {|
|
||||
statement;
|
||||
*/
|
||||
QTextBlock block = cursor.block();
|
||||
int indentation = tabSettings.indentationColumn(block.text());
|
||||
|
||||
if (block.next().isValid()) { // not the last block
|
||||
|
||||
Reference in New Issue
Block a user