Fixed an issue detecting a lexer for a new (unsaved) editor. 5_0_x

Tue, 01 Feb 2011 19:09:00 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Tue, 01 Feb 2011 19:09:00 +0100
branch
5_0_x
changeset 873
0d19ab5e30f8
parent 856
2fd0c2ea2487
child 876
e21d70cf933c

Fixed an issue detecting a lexer for a new (unsaved) editor.

QScintilla/Lexers/LexerPygments.py file | annotate | diff | comparison | revisions
diff -r 2fd0c2ea2487 -r 0d19ab5e30f8 QScintilla/Lexers/LexerPygments.py
--- a/QScintilla/Lexers/LexerPygments.py	Tue Jan 18 19:33:12 2011 +0100
+++ b/QScintilla/Lexers/LexerPygments.py	Tue Feb 01 19:09:00 2011 +0100
@@ -318,10 +318,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:

eric ide

mercurial