diff options
| author | Anthony Sottile <asottile@umich.edu> | 2019-08-10 11:35:14 -0700 |
|---|---|---|
| committer | Anthony Sottile <asottile@umich.edu> | 2019-08-10 11:37:01 -0700 |
| commit | e8c79dcd33972cbb798b94493216146f38e4d68e (patch) | |
| tree | 0e3a40e07d11f7ceb94d4ac961dc814b47e69f80 /src | |
| parent | d43d498d419fa1a0ec1489301d29d50fdd5be3f9 (diff) | |
| download | flake8-e8c79dcd33972cbb798b94493216146f38e4d68e.tar.gz | |
Fix --show-source when indented with tabs
Diffstat (limited to 'src')
| -rw-r--r-- | src/flake8/formatting/base.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/flake8/formatting/base.py b/src/flake8/formatting/base.py index 388ab0e..520dcbc 100644 --- a/src/flake8/formatting/base.py +++ b/src/flake8/formatting/base.py @@ -171,10 +171,13 @@ class BaseFormatter(object): # Because column numbers are 1-indexed, we need to remove one to get # the proper number of space characters. - pointer = (" " * (error.column_number - 1)) + "^" + indent = "".join( + c if c.isspace() else " " + for c in error.physical_line[: error.column_number - 1] + ) # Physical lines have a newline at the end, no need to add an extra # one - return error.physical_line + pointer + return "{}{}^".format(error.physical_line, indent) def _write(self, output): # type: (str) -> None """Handle logic of whether to use an output file or print().""" |
