This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: difflib HtmlDiff() extra space on inserted 1 character lines
Type: Stage:
Components: Library (Lib) Versions: Python 2.4
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: tim.peters Nosy List: dmgass, tim.peters
Priority: normal Keywords:

Created on 2004-10-26 19:44 by dmgass, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (2)
msg22882 - (view) Author: Dan Gass (dmgass) Date: 2004-10-26 19:44 -- rev 1.27
class - HtmlDiff
method - _make_line
line numbers 1370 thru 1371

            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.

msg22883 - (view) Author: Tim Peters (tim.peters) * (Python committer) Date: 2004-11-12 16:13
Logged In: YES 

Done; thanks!

Lib/ 1.28

Please attach a patch next time.  It's almost impossible to 
read code correctly after SF finishes mangling text.
Date User Action Args
2022-04-11 14:56:07adminsetgithub: 41085
2004-10-26 19:44:24dmgasscreate