forked from qt-creator/qt-creator
Integrate merge-request #444 into branch 'master'
Joel Nordell (1):
add ':' to electric keys for C++ indenting, and check for electric
keys anywhere on line, not just at beginning
Request-url: http://gitorious.org/qt-creator/qt-creator/merge_requests/444
Reviewed-by: Thorbjørn Lindeijer <thorbjorn.lindeijer@nokia.com>
This commit is contained in:
@@ -843,7 +843,8 @@ bool CPPEditor::isElectricCharacter(const QChar &ch) const
|
|||||||
{
|
{
|
||||||
if (ch == QLatin1Char('{') ||
|
if (ch == QLatin1Char('{') ||
|
||||||
ch == QLatin1Char('}') ||
|
ch == QLatin1Char('}') ||
|
||||||
ch == QLatin1Char('#')) {
|
ch == QLatin1Char('#') ||
|
||||||
|
ch == QLatin1Char(':')) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -992,11 +992,7 @@ void BaseTextEditor::keyPressEvent(QKeyEvent *e)
|
|||||||
QTextCursor cursor = textCursor();
|
QTextCursor cursor = textCursor();
|
||||||
const QString text = e->text();
|
const QString text = e->text();
|
||||||
cursor.insertText(text);
|
cursor.insertText(text);
|
||||||
const QString leftText = cursor.block().text().left(cursor.position() - 1 - cursor.block().position());
|
indent(document(), cursor, QChar::Null);
|
||||||
if (leftText.simplified().isEmpty()) {
|
|
||||||
const QChar typedChar = e->text().at(0);
|
|
||||||
indent(document(), cursor, typedChar);
|
|
||||||
}
|
|
||||||
#if 0
|
#if 0
|
||||||
TextEditDocumentLayout *documentLayout = qobject_cast<TextEditDocumentLayout*>(document()->documentLayout());
|
TextEditDocumentLayout *documentLayout = qobject_cast<TextEditDocumentLayout*>(document()->documentLayout());
|
||||||
QTC_ASSERT(documentLayout, return);
|
QTC_ASSERT(documentLayout, return);
|
||||||
|
|||||||
Reference in New Issue
Block a user