forked from qt-creator/qt-creator
Re-enable check for automatically inserted block end.
This commit is contained in:
@@ -40,6 +40,7 @@ static bool maybeOverrideChar(const QChar &ch)
|
|||||||
{
|
{
|
||||||
if (ch == QLatin1Char(')')) return true;
|
if (ch == QLatin1Char(')')) return true;
|
||||||
else if (ch == QLatin1Char(']')) return true;
|
else if (ch == QLatin1Char(']')) return true;
|
||||||
|
else if (ch == QLatin1Char(';')) return true;
|
||||||
else if (ch == QLatin1Char('"')) return true;
|
else if (ch == QLatin1Char('"')) return true;
|
||||||
else if (ch == QLatin1Char('\'')) return true;
|
else if (ch == QLatin1Char('\'')) return true;
|
||||||
else return false;
|
else return false;
|
||||||
@@ -97,8 +98,6 @@ MatchingText::MatchingText()
|
|||||||
QString MatchingText::insertMatchingBrace(const QTextCursor &cursor, const QString &textToProcess,
|
QString MatchingText::insertMatchingBrace(const QTextCursor &cursor, const QString &textToProcess,
|
||||||
const QChar &la, int *skippedChars) const
|
const QChar &la, int *skippedChars) const
|
||||||
{
|
{
|
||||||
*skippedChars = 0;
|
|
||||||
|
|
||||||
QTextCursor tc = cursor;
|
QTextCursor tc = cursor;
|
||||||
QString text = textToProcess;
|
QString text = textToProcess;
|
||||||
|
|
||||||
|
|||||||
@@ -1270,16 +1270,25 @@ bool CPPEditor::isElectricCharacter(const QChar &ch) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if 1
|
#if 1
|
||||||
QString CPPEditor::autoComplete(QTextCursor &cursor, const QString &text) const
|
QString CPPEditor::autoComplete(QTextCursor &cursor, const QString &textToInsert) const
|
||||||
{
|
{
|
||||||
|
bool checkBlockEnd = m_allowSkippingOfBlockEnd;
|
||||||
|
m_allowSkippingOfBlockEnd = false;
|
||||||
|
|
||||||
if (!contextAllowsAutoParentheses(cursor))
|
if (!contextAllowsAutoParentheses(cursor))
|
||||||
return QString();
|
return QString();
|
||||||
|
|
||||||
QChar lookAhead = characterAt(cursor.selectionEnd());
|
QString text = textToInsert;
|
||||||
|
const QChar lookAhead = characterAt(cursor.selectionEnd());
|
||||||
|
|
||||||
QString autoText;
|
QString autoText;
|
||||||
int skippedChars = 0;
|
int skippedChars = 0;
|
||||||
|
|
||||||
|
if (checkBlockEnd && (lookAhead == QChar::ParagraphSeparator && (! text.isEmpty() && text.at(0) == QLatin1Char('}')))) {
|
||||||
|
skippedChars = 2;
|
||||||
|
text = text.mid(1);
|
||||||
|
}
|
||||||
|
|
||||||
MatchingText matchingText;
|
MatchingText matchingText;
|
||||||
autoText = matchingText.insertMatchingBrace(cursor, text, lookAhead, &skippedChars);
|
autoText = matchingText.insertMatchingBrace(cursor, text, lookAhead, &skippedChars);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user