[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    =?utf-8?q?=5Bcalligra=5D_libs/kotext=3A_Fixing_a_bug_that_result?=
From:       Ganesh Paramasivam <ganesh () crystalfab ! com>
Date:       2011-04-13 10:55:49
Message-ID: 20110413105549.76A3FA609B () git ! kde ! org
[Download RAW message or body]

Git commit 7e34c45ce0f733008b489c83b15f9f47a0c39af8 by Ganesh Paramasivam.
Committed on 13/04/2011 at 12:55.
Pushed by ganeshp into branch 'master'.

Fixing a bug that resulted in the crash of words when the char-format of a fragment of text is changed

M  +11   -6    libs/kotext/KoTextEditor.cpp     

http://commits.kde.org/calligra/7e34c45ce0f733008b489c83b15f9f47a0c39af8

diff --git a/libs/kotext/KoTextEditor.cpp b/libs/kotext/KoTextEditor.cpp
index 3bc342f..d3f466d 100644
--- a/libs/kotext/KoTextEditor.cpp
+++ b/libs/kotext/KoTextEditor.cpp
@@ -363,12 +363,17 @@ void KoTextEditor::registerTrackedChange(QTextCursor &selection, KoGenChange::Ty
 
                 QTextCursor cursor(block);
                 cursor.setPosition(fragment.position());
-                QTextCharFormat fm = cursor.charFormat();
-                fm.clearProperty(KoCharacterStyle::ChangeTrackerId);
-                int to = qMin(end, fragment.position() + fragment.length());
-                cursor.setPosition(to, QTextCursor::KeepAnchor);
-                cursor.setCharFormat(fm);
-                ++iter;
+                QTextCharFormat fm = fragment.charFormat();
+                
+                if (fm.hasProperty(KoCharacterStyle::ChangeTrackerId)) {
+                    fm.clearProperty(KoCharacterStyle::ChangeTrackerId);
+                    int to = qMin(end, fragment.position() + fragment.length());
+                    cursor.setPosition(to, QTextCursor::KeepAnchor);
+                    cursor.setCharFormat(fm);
+                    iter = block.begin();
+                } else {
+                    iter++;
+                }
             }
             block = block.next();
         }

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic