Fix inserting on extra curly brace upon pressing enter key.

Special handling of the case in which the current token is
Token::RightBrace. This works in every case *except* for nested braces
without separator between them.

Change-Id: Ief625086c4d33ba77b36b1181e78cad124feb7a9
Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
This commit is contained in:
Marco Benelli
2015-04-27 10:36:29 +02:00
parent 13fcf5ad3c
commit d92055dde4

View File

@@ -179,6 +179,9 @@ bool AutoCompleter::contextAllowsAutoParentheses(const QTextCursor &cursor,
case Token::Comment: case Token::Comment:
return false; return false;
case Token::RightBrace:
return false;
case Token::String: { case Token::String: {
const QString blockText = cursor.block().text(); const QString blockText = cursor.block().text();
const QStringRef tokenText = blockText.midRef(token.offset, token.length); const QStringRef tokenText = blockText.midRef(token.offset, token.length);