Skip to content

Commit 9283cce

Browse files
committed
Fix caret position when line contains tabs
1 parent f45d302 commit 9283cce

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

CHANGES.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ Bug fixes:
1919

2020
* Fix E501 not detected in comments with Python 2.5.
2121

22+
* Fix caret position with ``--show-source`` when line contains tabs.
23+
2224

2325
1.5.1 (2014-03-27)
2426
------------------

pep8.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1600,7 +1600,7 @@ def get_file_results(self):
16001600
else:
16011601
line = self.lines[line_number - 1]
16021602
print(line.rstrip())
1603-
print(' ' * offset + '^')
1603+
print(re.sub(r'\S', ' ', line[:offset]) + '^')
16041604
if self._show_pep8 and doc:
16051605
print(' ' + doc.strip())
16061606
return self.file_errors

0 commit comments

Comments
 (0)