Skip to content

Commit 384aea7

Browse files
author
whitequark
committedAug 31, 2015
Fix diagnostics render for source lines that include tabs.
1 parent 89d137f commit 384aea7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed
 

Diff for: ‎pythonparser/diagnostic.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
from __future__ import absolute_import, division, print_function, unicode_literals
77
from functools import reduce
8-
import sys
8+
import sys, re
99

1010
class Diagnostic:
1111
"""
@@ -74,7 +74,7 @@ def render(self, only_line=False, colored=False):
7474
:param only_line: (bool) If true, only print line number, not line and column range
7575
"""
7676
source_line = self.location.source_line().rstrip("\n")
77-
highlight_line = bytearray(" ", "utf-8") * len(source_line)
77+
highlight_line = bytearray(re.sub(r"[^\t]", " ", source_line), "utf-8")
7878

7979
for hilight in self.highlights:
8080
if hilight.line() == self.location.line():

0 commit comments

Comments
 (0)