add ':' to electric keys for C++ indenting, and check for electric keys anywhere on line, not just at beginning

This commit is contained in:
Joel Nordell
2009-05-18 14:38:22 -05:00
parent bb6f56f553
commit 4c07de50b2
2 changed files with 3 additions and 6 deletions

View File

@@ -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);