Commit 88e054e8 authored by Christian Kamm's avatar Christian Kamm Committed by Nikolai Kosjar
Browse files

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: default avatarNikolai Kosjar <nikolai.kosjar@digia.com>
parent 428c1b9c
......@@ -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());
}
......
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