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

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

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Fri, 20 Jan 2012 18:54:06 +0100
branch
5_2_x
changeset 1564
9f19fde2d6ca
parent 1560
a110f9c86aaf
child 1565
815eb7a39944

Fixed an issue with the Pygments lexer because it is ignoring trailing empty lines.
(transplanted from 9d2cccd2074e1437d76047753ebbb33aa4c55fcf)

QScintilla/Lexers/LexerPygments.py file | annotate | diff | comparison | revisions
--- a/QScintilla/Lexers/LexerPygments.py	Mon Jan 16 19:33:26 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