forked from qt-creator/qt-creator
add ':' to electric keys for C++ indenting, and check for electric keys anywhere on line, not just at beginning
This commit is contained in:
@@ -932,11 +932,7 @@ void BaseTextEditor::keyPressEvent(QKeyEvent *e)
|
||||
QTextCursor cursor = textCursor();
|
||||
const QString text = e->text();
|
||||
cursor.insertText(text);
|
||||
const QString leftText = cursor.block().text().left(cursor.position() - 1 - cursor.block().position());
|
||||
if (leftText.simplified().isEmpty()) {
|
||||
const QChar typedChar = e->text().at(0);
|
||||
indent(document(), cursor, typedChar);
|
||||
}
|
||||
indent(document(), cursor, QChar::Null);
|
||||
#if 0
|
||||
TextEditDocumentLayout *documentLayout = qobject_cast<TextEditDocumentLayout*>(document()->documentLayout());
|
||||
QTC_ASSERT(documentLayout, return);
|
||||
|
||||
Reference in New Issue
Block a user