diff options
author | Tim Peters <tim.peters@gmail.com> | 2004-11-12 16:12:15 (GMT) |
---|---|---|
committer | Tim Peters <tim.peters@gmail.com> | 2004-11-12 16:12:15 (GMT) |
commit | 0ca0c64409056047b4e24617f79a8faff93c2875 (patch) | |
tree | 879493d191a12f5888a90f43ecee498457c15983 | |
parent | 195404ff900cc7bb72517c4dbdda5b203b4c8b3c (diff) | |
download | cpython-0ca0c64409056047b4e24617f79a8faff93c2875.zip cpython-0ca0c64409056047b4e24617f79a8faff93c2875.tar.gz cpython-0ca0c64409056047b4e24617f79a8faff93c2875.tar.bz2 |
SF bug 1054821: difflib HtmlDiff() extra space on inserted 1 character lines
Simple correction from the code's author (Dan Gass).
-rw-r--r-- | Lib/difflib.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/difflib.py b/Lib/difflib.py index 124ae90..590785f 100644 --- a/Lib/difflib.py +++ b/Lib/difflib.py @@ -1367,8 +1367,8 @@ def _mdiff(fromlines, tolines, context=None, linejunk=None, text = lines.pop(0)[2:] # if line of text is just a newline, insert a space so there is # something for the user to highlight and see. - if len(text) <= 1: - text = ' '+text + if not text: + text = ' ' # insert marks that won't be noticed by an xml/html escaper. text = '\0' + format_key + text + '\1' # Return line of text, first allow user's line formatter to do it's |