Tue, 01 Feb 2011 16:40:14 +0100
Fixed an issue detecting a lexer for a new (unsaved) editor.
QScintilla/Lexers/LexerPygments.py | file | annotate | diff | comparison | revisions |
--- a/QScintilla/Lexers/LexerPygments.py Tue Feb 01 16:39:33 2011 +0100 +++ b/QScintilla/Lexers/LexerPygments.py Tue Feb 01 16:40:14 2011 +0100 @@ -373,10 +373,11 @@ # step 1: guess based on filename and text if self.editor is not None: fn = self.editor.getFileName() - try: - lexer = guess_lexer_for_filename(fn, text) - except ClassNotFound: - pass + if fn: + try: + lexer = guess_lexer_for_filename(fn, text) + except ClassNotFound: + pass # step 2: guess on text only if lexer is None: