[ python-Bugs-1054821 ] difflib HtmlDiff() extra space on inserted
1 character lines
SourceForge.net
noreply at sourceforge.net
Fri Nov 12 17:13:48 CET 2004
Bugs item #1054821, was opened at 2004-10-26 15:44
Message generated for change (Comment added) made by tim_one
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1054821&group_id=5470
Category: Python Library
Group: Python 2.4
>Status: Closed
>Resolution: Fixed
Priority: 5
Submitted By: Dan Gass (dmgass)
>Assigned to: Tim Peters (tim_one)
Summary: difflib HtmlDiff() extra space on inserted 1 character lines
Initial Comment:
difflib.py -- rev 1.27
class - HtmlDiff
method - _make_line
line numbers 1370 thru 1371
was:
if len(text) <= 1:
text = ' '+text
should be:
if not text:
text = ' '
This code was intended to show an "add" highlight in
the case of inserted blank lines. It was originally
coded to look for lines of length 1 or less to
accomodate lines where the newline character is not
stripped off. The undesired effect is that lines
containing only one character (such as a open or close
{} for a 'c' function) that are in column zero get
represented with a space infront of it.
Since newlines are stripped before this code is
executed (a code change done after this logic was
written) the above fix eliminates the undesired effect
without sacrificing anything.
The test for this module will not break as a result of
this change. If it is desired, I can modify the test
to cover this code. It would involve adding a blank
line and possibly a one character line to the test
input and then rebaselining the output.
----------------------------------------------------------------------
>Comment By: Tim Peters (tim_one)
Date: 2004-11-12 11:13
Message:
Logged In: YES
user_id=31435
Done; thanks!
Lib/difflib.py 1.28
Please attach a patch next time. It's almost impossible to
read code correctly after SF finishes mangling text.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1054821&group_id=5470
More information about the Python-bugs-list
mailing list