hgext/highlight/highlight.py
changeset 25899 c35ee1bbbbdc
parent 25867 a74e9806d17d
child 26680 7a3f6490ef97
--- a/hgext/highlight/highlight.py	Mon Aug 03 14:16:51 2015 -0700
+++ b/hgext/highlight/highlight.py	Sun Aug 02 19:18:35 2015 +0800
@@ -49,7 +49,12 @@
         try:
             lexer = guess_lexer(text[:1024], stripnl=False)
         except (ClassNotFound, ValueError):
-            lexer = TextLexer(stripnl=False)
+            # Don't highlight unknown files
+            return
+
+    # Don't highlight text files
+    if isinstance(lexer, TextLexer):
+        return
 
     formatter = HtmlFormatter(nowrap=True, style=style)