summaryrefslogtreecommitdiffstats
path: root/src/gui/text/qtextdocument_p.cpp
diff options
context:
space:
mode:
authorThomas Zander <t.zander@nokia.com>2009-11-16 10:16:47 (GMT)
committerThomas Zander <thomas.zander@trolltech.com>2009-11-16 12:02:13 (GMT)
commit7e1f19c3e3036f166a84dbaa916ec1da1cc818c6 (patch)
tree8b1a7128a7e0549c4c734a0748643c007ad04bf2 /src/gui/text/qtextdocument_p.cpp
parentdbaea6fa5a90742d89691685baa44a1a34598f21 (diff)
downloadQt-7e1f19c3e3036f166a84dbaa916ec1da1cc818c6.zip
Qt-7e1f19c3e3036f166a84dbaa916ec1da1cc818c6.tar.gz
Qt-7e1f19c3e3036f166a84dbaa916ec1da1cc818c6.tar.bz2
Fix regression in emitting of QTextDocument::undoCommandAdded()
The test I wrote was not testing if calling undo/redo had any effect on emitting undoCommandAdded(), added these test cases and fixed the QTextDocumentPrivate::endEditBlock so we now again emit only when an undo command is added, not also on calling undo or redo. Reviewed-by: mae Reviewed-by: Samuel Rødal
Diffstat (limited to 'src/gui/text/qtextdocument_p.cpp')
-rw-r--r--src/gui/text/qtextdocument_p.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/gui/text/qtextdocument_p.cpp b/src/gui/text/qtextdocument_p.cpp
index 2ad6512..18e1ffc 100644
--- a/src/gui/text/qtextdocument_p.cpp
+++ b/src/gui/text/qtextdocument_p.cpp
@@ -1114,9 +1114,11 @@ void QTextDocumentPrivate::endEditBlock()
return;
if (undoEnabled && undoState > 0) {
+ const bool wasBlocking = !undoStack[undoState - 1].block_end;
if (undoStack[undoState - 1].block_part) {
undoStack[undoState - 1].block_end = true;
- emit document()->undoCommandAdded();
+ if (wasBlocking)
+ emit document()->undoCommandAdded();
}
}