Mercurial > cpython-lru_cache-weakref
diff Lib/difflib.py @ 57417:3a2b149ae66e 3.1
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.
........
................
| author | Senthil Kumaran <orsenthil@gmail.com> |
|---|---|
| date | Mon, 23 Nov 2009 19:06:11 +0000 |
| parents | d06a3ebf306f |
| children | bf94b6a73fc8 fcfe324663a6 |
line wrap: on
line diff
--- a/Lib/difflib.py Mon Nov 23 16:42:35 2009 +0000 +++ b/Lib/difflib.py Mon Nov 23 19:06:11 2009 +0000 @@ -1060,20 +1060,21 @@ 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()
