QScintilla/Lexers/LexerPygments.py

branch
5_2_x
changeset 1564
9f19fde2d6ca
parent 1509
c0b5e693b0eb
child 2302
f29e9405c851
equal deleted inserted replaced
1560:a110f9c86aaf 1564:9f19fde2d6ca
423 """ 423 """
424 text = self.editor.text()[:end + 1] 424 text = self.editor.text()[:end + 1]
425 self.__lexer = self.__guessLexer(text) 425 self.__lexer = self.__guessLexer(text)
426 426
427 cpos = 0 427 cpos = 0
428 # adjust start position because pygments ignores empty line at start of text
429 for c in text:
430 if c == "\n":
431 cpos += 1
432 else:
433 break
434
428 self.editor.startStyling(cpos, 0x3f) 435 self.editor.startStyling(cpos, 0x3f)
429 if self.__lexer is None: 436 if self.__lexer is None:
430 self.editor.setStyling(len(text), PYGMENTS_DEFAULT) 437 self.editor.setStyling(len(text), PYGMENTS_DEFAULT)
431 else: 438 else:
432 eolLen = len(self.editor.getLineSeparator()) 439 eolLen = len(self.editor.getLineSeparator())

eric ide

mercurial