Ensure there is a blank line before each new item

This commit is contained in:
Kovid Goyal 2018-05-09 08:33:24 +05:30
parent b663160bc2
commit 3820c46801
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 7 additions and 2 deletions

View File

@ -64,6 +64,9 @@ def __iter__(self):
data = None
yield path, typ, data
def __len__(self):
return len(self.all_paths)
def collect_files(collection, left, right):
left_names, right_names = set(), set()

View File

@ -154,7 +154,6 @@ def fl(path, fmt):
yield fl(path, removed_format) + filler
else:
yield fl(path, removed_format) + fl(other_path, added_format)
yield ''
def split_to_size(line, width):
@ -362,8 +361,9 @@ def render_diff(collection, diff_map, args, columns):
largest_line_number = max(largest_line_number, patch.largest_line_number)
margin_size = max(3, len(str(largest_line_number)) + 1)
last_item_num = len(collection) - 1
for path, item_type, other_path in collection:
for i, (path, item_type, other_path) in enumerate(collection):
item_ref = Reference(path)
is_binary = isinstance(data_for_path(path), bytes)
yield from yield_lines_from(title_lines(path, other_path, args, columns, margin_size), item_ref, False)
@ -387,3 +387,5 @@ def render_diff(collection, diff_map, args, columns):
else:
raise ValueError('Unsupported item type: {}'.format(item_type))
yield from ans
if i < last_item_num:
yield Line('', item_ref)