From 85a14abd2e52c832374dd67b3acf05f2b6eaea0e Mon Sep 17 00:00:00 2001 From: Leandro Melo Date: Fri, 12 Aug 2011 18:45:42 +0200 Subject: 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 --- src/gui/text/qtextdocument_p.cpp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'src/gui/text/qtextdocument_p.cpp') 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; -- cgit v1.2.3