hgext/highlight.py
changeset 6664 1e3c1f010808
parent 6511 5c1bb5750558
child 6665 73f49bef13ad
--- a/hgext/highlight.py	Thu Jun 12 08:53:23 2008 +0200
+++ b/hgext/highlight.py	Thu Jun 12 00:11:09 2008 -0700
@@ -49,11 +49,11 @@
 
     # To get multi-line strings right, we can't format line-by-line
     try:
-        lexer = guess_lexer_for_filename(fctx.path(), text,
+        lexer = guess_lexer_for_filename(fctx.path(), text[:1024],
                                          encoding=util._encoding)
     except (ClassNotFound, ValueError):
         try:
-            lexer = guess_lexer(text, encoding=util._encoding)
+            lexer = guess_lexer(text[:1024], encoding=util._encoding)
         except (ClassNotFound, ValueError):
             lexer = TextLexer(encoding=util._encoding)