diff options
author | Senthil Kumaran <orsenthil@gmail.com> | 2009-11-23 18:41:31 (GMT) |
---|---|---|
committer | Senthil Kumaran <orsenthil@gmail.com> | 2009-11-23 18:41:31 (GMT) |
commit | 5c456e6f4571fec64a98e28e7e316972f35d19fc (patch) | |
tree | c8d68f50c39733465208de8d1f8cfe551c003444 /Lib/difflib.py | |
parent | f058d2dc0835eecf75c1d93d77e8e3b7c372a862 (diff) | |
download | cpython-5c456e6f4571fec64a98e28e7e316972f35d19fc.zip cpython-5c456e6f4571fec64a98e28e7e316972f35d19fc.tar.gz cpython-5c456e6f4571fec64a98e28e7e316972f35d19fc.tar.bz2 |
Fix for issue1488943 - difflib.Differ() doesn't always add hints for tab
characters.
Diffstat (limited to 'Lib/difflib.py')
-rw-r--r-- | Lib/difflib.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/Lib/difflib.py b/Lib/difflib.py index 679bd2a..b43dc97 100644 --- a/Lib/difflib.py +++ b/Lib/difflib.py @@ -1061,20 +1061,21 @@ class Differ: Example: >>> d = Differ() - >>> results = d._qformat('\tabcDefghiJkl\n', '\t\tabcdefGhijkl\n', - ... ' ^ ^ ^ ', '+ ^ ^ ^ ') + >>> results = d._qformat('\tabcDefghiJkl\n', '\tabcdefGhijkl\n', + ... ' ^ ^ ^ ', ' ^ ^ ^ ') >>> for line in results: print repr(line) ... '- \tabcDefghiJkl\n' '? \t ^ ^ ^\n' - '+ \t\tabcdefGhijkl\n' - '? \t ^ ^ ^\n' + '+ \tabcdefGhijkl\n' + '? \t ^ ^ ^\n' """ # Can hurt, but will probably help most of the time. common = min(_count_leading(aline, "\t"), _count_leading(bline, "\t")) common = min(common, _count_leading(atags[:common], " ")) + common = min(common, _count_leading(btags[:common], " ")) atags = atags[common:].rstrip() btags = btags[common:].rstrip() |