forked from qt-creator/qt-creator
Autoindent: Don't reindent on every autotext insert.
Currently the line is completely reintented whenever an autoText insert is being done (like inserting a matching paren). This is un- necessary as well as actively harmful. Unnecessary, because the electric character mechanism is already supposed to trigger reindents where necessary. Harmful, because the reindent method that is used does not take care to preserve explicit user indentation. The electric character reindent does that (by only changing indentation if the actual current indent is the same as the previously expected indent). Change-Id: I19db853b6c30792f867baad919bd4eb9b4c23361 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
This commit is contained in:
committed by
Nikolai Kosjar
parent
428c1b9cc8
commit
88e054e845
@@ -1909,8 +1909,6 @@ void BaseTextEditorWidget::keyPressEvent(QKeyEvent *e)
|
||||
if (!electricChar.isNull() && d->m_autoCompleter->contextAllowsElectricCharacters(cursor))
|
||||
indent(document(), cursor, electricChar);
|
||||
if (!autoText.isEmpty()) {
|
||||
if (d->m_document->typingSettings().m_autoIndent)
|
||||
reindent(document(), cursor);
|
||||
cursor.setPosition(autoText.length() == 1 ? cursor.position() : cursor.anchor());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user