aboutsummaryrefslogtreecommitdiff
path: root/src/corelib/widgets/mtextedit.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/widgets/mtextedit.cpp')
-rw-r--r--src/corelib/widgets/mtextedit.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/corelib/widgets/mtextedit.cpp b/src/corelib/widgets/mtextedit.cpp
index d3ad0679..5f61b6bb 100644
--- a/src/corelib/widgets/mtextedit.cpp
+++ b/src/corelib/widgets/mtextedit.cpp
@@ -1519,14 +1519,16 @@ void MTextEdit::keyPressEvent(QKeyEvent *event)
d->commitPreedit();
}
+ // Whether text was modified, excluding the removal of 'needRemoveFirst' text above.
bool modified = false;
switch (key) {
case Qt::Key_Backspace:
// backspace and delete in selection mode are special cases, only selection is removed
+ // These also need explicit validation here.
if (wasSelecting == false) {
modified = d->doBackspace();
- } else {
+ } else if (d->validateCurrentBlock()) {
d->cursor()->setCharFormat(format);
modified = true;
}
@@ -1535,7 +1537,7 @@ void MTextEdit::keyPressEvent(QKeyEvent *event)
case Qt::Key_Delete:
if (wasSelecting == false) {
modified = d->doDelete();
- } else {
+ } else if (d->validateCurrentBlock()) {
modified = true;
}
break;