Fixed the {begin,end}EndBlock to be used when inserting autotext

Based on a change by Denis Dzyubenko, done with mae.
This commit is contained in:
Thorbjørn Lindeijer
2009-09-17 13:33:42 +02:00
parent b765124163
commit 0fed004ad4

View File

@@ -1066,7 +1066,9 @@ void BaseTextEditor::keyPressEvent(QKeyEvent *e)
}
}
}
if (!electricChar.isNull())
bool doEditBlock = !(electricChar.isNull() && autoText.isEmpty());
if (doEditBlock)
cursor.beginEditBlock();
cursor.insertText(text);
@@ -1076,10 +1078,12 @@ void BaseTextEditor::keyPressEvent(QKeyEvent *e)
cursor.insertText(autoText);
cursor.setPosition(pos);
}
if (!electricChar.isNull()) {
if (!electricChar.isNull())
indent(document(), cursor, electricChar);
if (doEditBlock)
cursor.endEditBlock();
}
setTextCursor(cursor);
}