summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGES.txt2
-rwxr-xr-xpep8.py2
2 files changed, 3 insertions, 1 deletions
diff --git a/CHANGES.txt b/CHANGES.txt
index 8bd915c..5457e26 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -19,6 +19,8 @@ Bug fixes:
* Fix E501 not detected in comments with Python 2.5.
+* Fix caret position with ``--show-source`` when line contains tabs.
+
1.5.1 (2014-03-27)
------------------
diff --git a/pep8.py b/pep8.py
index c8ff573..ba08b89 100755
--- a/pep8.py
+++ b/pep8.py
@@ -1600,7 +1600,7 @@ class StandardReport(BaseReport):
else:
line = self.lines[line_number - 1]
print(line.rstrip())
- print(' ' * offset + '^')
+ print(re.sub(r'\S', ' ', line[:offset]) + '^')
if self._show_pep8 and doc:
print(' ' + doc.strip())
return self.file_errors