QScintilla/Lexers/LexerPygments.py

branch
5_3_x
changeset 2520
d226e801d308
parent 2302
f29e9405c851
child 2525
8b507a9a2d40
child 2656
192f4e0024c2
diff -r 1697fb3ad2d6 -r d226e801d308 QScintilla/Lexers/LexerPygments.py
--- a/QScintilla/Lexers/LexerPygments.py	Sat Mar 23 16:03:22 2013 +0100
+++ b/QScintilla/Lexers/LexerPygments.py	Sun Mar 24 13:08:24 2013 +0100
@@ -422,6 +422,7 @@
         @param end position of last character to be styled (integer)
         """
         text = self.editor.text()[:end + 1]
+        textLen = len(text.encode("utf-8"))
         self.__lexer = self.__guessLexer(text)
         
         cpos = 0
@@ -443,9 +444,11 @@
                 tlen = len(txt.encode('utf-8'))
                 if eolLen > 1:
                     tlen += txt.count('\n')
-                if tlen:
+                cpos += tlen
+                if tlen and cpos < textLen:
                     self.editor.setStyling(tlen, style)
-                cpos += tlen
+                else:
+                    break
             self.editor.startStyling(cpos, 0x3f)
     
     def isCommentStyle(self, style):

eric ide

mercurial