diff --git a/hgext/highlight/highlight.py b/hgext/highlight/highlight.py --- a/hgext/highlight/highlight.py +++ b/hgext/highlight/highlight.py @@ -38,12 +38,13 @@ def pygmentize(field, fctx, style, tmpl) # To get multi-line strings right, we can't format line-by-line try: - lexer = guess_lexer_for_filename(fctx.path(), text[:1024]) + lexer = guess_lexer_for_filename(fctx.path(), text[:1024], + stripnl=False) except (ClassNotFound, ValueError): try: - lexer = guess_lexer(text[:1024]) + lexer = guess_lexer(text[:1024], stripnl=False) except (ClassNotFound, ValueError): - lexer = TextLexer() + lexer = TextLexer(stripnl=False) formatter = HtmlFormatter(style=style)