summaryrefslogtreecommitdiff
path: root/Lib/difflib.py
diff options
context:
space:
mode:
authorSenthil Kumaran <orsenthil@gmail.com>2009-11-23 18:54:33 +0000
committerSenthil Kumaran <orsenthil@gmail.com>2009-11-23 18:54:33 +0000
commit4702aef1ad7ce92f083e54d264a6cee126edd467 (patch)
treeb35c55fc6d6181ca4056d23f1b67ac6d8ca24edb /Lib/difflib.py
parent2002eeabaf5bcd514f6c782b125ce93c3dbd34e9 (diff)
downloadcpython-git-4702aef1ad7ce92f083e54d264a6cee126edd467.tar.gz
Merged revisions 76464 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r76464 | senthil.kumaran | 2009-11-24 00:11:31 +0530 (Tue, 24 Nov 2009) | 4 lines Fix for issue1488943 - difflib.Differ() doesn't always add hints for tab characters. ........
Diffstat (limited to 'Lib/difflib.py')
-rw-r--r--Lib/difflib.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/Lib/difflib.py b/Lib/difflib.py
index 679bd2a01a..b43dc970e2 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()