Fixed an issue with the Pygments lexer because it is ignoring trailing empty lines.

Fri, 20 Jan 2012 18:54:06 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Fri, 20 Jan 2012 18:54:06 +0100
changeset 1563
9d2cccd2074e
parent 1562
1e9a236987d8
child 1566
0cb791cc631a

Fixed an issue with the Pygments lexer because it is ignoring trailing empty lines.

QScintilla/Lexers/LexerPygments.py file | annotate | diff | comparison | revisions
--- a/QScintilla/Lexers/LexerPygments.py	Wed Jan 18 19:59:42 2012 +0100
+++ b/QScintilla/Lexers/LexerPygments.py	Fri Jan 20 18:54:06 2012 +0100
@@ -425,6 +425,13 @@
         self.__lexer = self.__guessLexer(text)
         
         cpos = 0
+        # adjust start position because pygments ignores empty line at start of text
+        for c in text:
+            if c == "\n":
+                cpos += 1
+            else:
+                break
+        
         self.editor.startStyling(cpos, 0x3f)
         if self.__lexer is None:
             self.editor.setStyling(len(text), PYGMENTS_DEFAULT)

eric ide

mercurial