Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0ca0c64

Browse files
committed
SF bug 1054821: difflib HtmlDiff() extra space on inserted 1 character lines
Simple correction from the code's author (Dan Gass).
1 parent 195404f commit 0ca0c64

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

Lib/difflib.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1367,8 +1367,8 @@ def record_sub_info(match_object,sub_info=sub_info):
13671367
text = lines.pop(0)[2:]
13681368
# if line of text is just a newline, insert a space so there is
13691369
# something for the user to highlight and see.
1370-
if len(text) <= 1:
1371-
text = ' '+text
1370+
if not text:
1371+
text = ' '
13721372
# insert marks that won't be noticed by an xml/html escaper.
13731373
text = '\0' + format_key + text + '\1'
13741374
# Return line of text, first allow user's line formatter to do it's

0 commit comments

Comments
 (0)