Commit 4c07de50 authored by Joel Nordell's avatar Joel Nordell
Browse files

add ':' to electric keys for C++ indenting, and check for electric keys...

add ':' to electric keys for C++ indenting, and check for electric keys anywhere on line, not just at beginning
parent bb6f56f5
......@@ -842,7 +842,8 @@ bool CPPEditor::isElectricCharacter(const QChar &ch) const
{
if (ch == QLatin1Char('{') ||
ch == QLatin1Char('}') ||
ch == QLatin1Char('#')) {
ch == QLatin1Char('#') ||
ch == QLatin1Char(':')) {
return true;
}
return false;
......
......@@ -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);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment