summaryrefslogtreecommitdiffstats
path: root/Lib/difflib.py
diff options
context:
space:
mode:
authorSenthil Kumaran <orsenthil@gmail.com>2009-11-23 19:06:11 (GMT)
committerSenthil Kumaran <orsenthil@gmail.com>2009-11-23 19:06:11 (GMT)
commitd884f8a9c4f62991b7f2b329bc3074aa3f93df4c (patch)
tree89894b850e69ee6424fddd3955292a8b7792a0eb /Lib/difflib.py
parenteb0146858b9778a7d75276a77c77d5efc9a88a4e (diff)
downloadcpython-d884f8a9c4f62991b7f2b329bc3074aa3f93df4c.zip
cpython-d884f8a9c4f62991b7f2b329bc3074aa3f93df4c.tar.gz
cpython-d884f8a9c4f62991b7f2b329bc3074aa3f93df4c.tar.bz2
Merged revisions 76469 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k ................ r76469 | senthil.kumaran | 2009-11-24 00:32:52 +0530 (Tue, 24 Nov 2009) | 10 lines 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 052a627..264860e 100644
--- a/Lib/difflib.py
+++ b/Lib/difflib.py
@@ -1060,20 +1060,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()