summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <montel@kde.org>2016-08-26 11:26:23 (GMT)
committerMontel Laurent <montel@kde.org>2016-08-26 11:26:23 (GMT)
commit5b38184696f93231c99097a79f35a9cc6493f030 (patch)
treeea3bce49e6abb758d7004c6da7888d3cb8e2a852
parentf46c6efeddbb28ba464ce8e5d9b3930e989b3d06 (diff)
Minor optimization
-rw-r--r--messagecomposer/src/composer-ng/richtextcomposerng.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/messagecomposer/src/composer-ng/richtextcomposerng.cpp b/messagecomposer/src/composer-ng/richtextcomposerng.cpp
index ea99e5c..c9fdaf1 100644
--- a/messagecomposer/src/composer-ng/richtextcomposerng.cpp
+++ b/messagecomposer/src/composer-ng/richtextcomposerng.cpp
@@ -100,7 +100,8 @@ bool RichTextComposerNg::processAutoCorrection(QKeyEvent *e)
const bool addSpace = d->autoCorrection->autocorrect(richText, *document(), position);
QTextCursor cur = textCursor();
cur.setPosition(position);
- if (overwriteMode() && e->key() == Qt::Key_Space) {
+ const bool spacePressed = (e->key() == Qt::Key_Space);
+ if (overwriteMode() && spacePressed) {
if (addSpace) {
const QChar insertChar = QLatin1Char(' ');
if (!cur.atBlockEnd()) {
@@ -114,7 +115,7 @@ bool RichTextComposerNg::processAutoCorrection(QKeyEvent *e)
setTextCursor(cur);
}
} else {
- const bool spacePressed = (e->key() == Qt::Key_Space);
+
const QChar insertChar = spacePressed ? QLatin1Char(' ') : QLatin1Char('\n');
if (richText && !isSpecial(initialTextFormat)) {
if ((spacePressed && addSpace) || !spacePressed) {