summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLeandro Melo <leandro.melo@nokia.com>2011-08-12 18:45:42 +0200
committerQt by Nokia <qt-info@nokia.com>2012-01-17 09:09:03 +0100
commit85a14abd2e52c832374dd67b3acf05f2b6eaea0e (patch)
treee724cd3d8cab92d34c4de85926d015171672c087 /src
parent402a8c036b2922a23a0a5310c608793d099dd26b (diff)
Join user state of removed text blocks
Note: Indentation of surrounding code was fixed. Done-with: mae (cherry picked from commit 8d3d3381c127f0f4dd9fc507c3069acddbf40535) Change-Id: I8d3d3381c127f0f4dd9fc507c3069acddbf40535 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>
Diffstat (limited to 'src')
-rw-r--r--src/gui/text/qtextdocument_p.cpp19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/gui/text/qtextdocument_p.cpp b/src/gui/text/qtextdocument_p.cpp
index 9e410b40af..47d99a07de 100644
--- a/src/gui/text/qtextdocument_p.cpp
+++ b/src/gui/text/qtextdocument_p.cpp
@@ -531,16 +531,17 @@ int QTextDocumentPrivate::remove_block(int pos, int *blockFormat, int command, Q
Q_ASSERT(b);
if (blocks.size(b) == 1 && command == QTextUndoCommand::BlockAdded) {
- Q_ASSERT((int)blocks.position(b) == pos);
-// qDebug("removing empty block");
- // empty block remove the block itself
+ Q_ASSERT((int)blocks.position(b) == pos);
+ // qDebug("removing empty block");
+ // empty block remove the block itself
} else {
- // non empty block, merge with next one into this block
-// qDebug("merging block with next");
- int n = blocks.next(b);
- Q_ASSERT((int)blocks.position(n) == pos + 1);
- blocks.setSize(b, blocks.size(b) + blocks.size(n) - 1);
- b = n;
+ // non empty block, merge with next one into this block
+ // qDebug("merging block with next");
+ int n = blocks.next(b);
+ Q_ASSERT((int)blocks.position(n) == pos + 1);
+ blocks.setSize(b, blocks.size(b) + blocks.size(n) - 1);
+ blocks.fragment(b)->userState = blocks.fragment(n)->userState;
+ b = n;
}
*blockFormat = blocks.fragment(b)->format;