summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorent Xicluna <florent.xicluna@gmail.com>2014-04-03 23:55:02 +0200
committerFlorent Xicluna <florent.xicluna@gmail.com>2014-04-03 23:55:02 +0200
commit9283cce1b5b2756d8f17784931fae4612c12b29b (patch)
tree204bd7afd79e5dc4314cd5786a1cc7f83e9bc269
parentf45d3020c9e38aecc2f736ab274b4bf759319cad (diff)
downloadpep8-9283cce1b5b2756d8f17784931fae4612c12b29b.tar.gz
Fix caret position when line contains tabs
-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