summaryrefslogtreecommitdiffstats
path: root/source/kde/patch/ktouch/ktouch.performance.diff
blob: 526294fe27ead8960cae9c77602f25b016a8a1aa (about) (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
diff --git a/src/declarativeitems/lessonpainter.cpp b/src/declarativeitems/lessonpainter.cpp
index dc8fc61..2c56c0c 100644
--- a/src/declarativeitems/lessonpainter.cpp
+++ b/src/declarativeitems/lessonpainter.cpp
@@ -236,8 +236,7 @@ void LessonPainter::updateTrainingStatus()
     const QString referenceLine = m_trainingLineCore->referenceLine();
     const QString actualLine = m_trainingLineCore->actualLine();
     const QString preeditString = m_trainingLineCore->preeditString();
-    const QTextBlock block = m_doc->findBlockByNumber(m_currentLine + 1);
-    const int blockPosition = block.position();
+    const int blockPosition = m_doc->findBlockByNumber(m_currentLine + 1).position();
 
     for (int linePos = 0; linePos < referenceLine.length(); linePos++)
     {
@@ -257,8 +256,14 @@ void LessonPainter::updateTrainingStatus()
 
         cursor.setPosition(charPosition, QTextCursor::MoveAnchor);
         cursor.setPosition(charPosition + 1, QTextCursor::KeepAnchor);
-        cursor.deleteChar();
-        cursor.insertText(QString(displayedChar), charFormat);
+	
+        /* QUICKFIX: Using the charFormat to decide whether a char must be repainted or not.
+         * Not nice but quite efficient ... */
+        if (cursor.charFormat() != charFormat)
+        {
+            cursor.deleteChar();
+            cursor.insertText(QString(displayedChar), charFormat);
+        }
     }
 
     invalidateImageCache();