Pass the image manager to the render code

This commit is contained in:
Kovid Goyal 2018-05-09 20:12:39 +05:30
parent 27feccba39
commit 6d038f5cdf
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 6 additions and 6 deletions

View File

@ -68,7 +68,7 @@ class DiffHandler(Handler):
self.start_job('diff', generate_diff, self.collection, self.current_context_count)
def render_diff(self):
self.diff_lines = tuple(render_diff(self.collection, self.diff_map, self.args, self.screen_size.cols))
self.diff_lines = tuple(render_diff(self.collection, self.diff_map, self.args, self.screen_size.cols, self.image_manager))
self.ref_path_map = defaultdict(list)
for i, l in enumerate(self.diff_lines):
self.ref_path_map[l.ref.path].append((i, l.ref))

View File

@ -353,12 +353,12 @@ def rename_lines(path, other_path, args, columns, margin_size):
yield m + line
def image_lines(left_path, right_path, columns, margin_size):
def image_lines(left_path, right_path, columns, margin_size, image_manager):
if False:
yield 0
def render_diff(collection, diff_map, args, columns):
def render_diff(collection, diff_map, args, columns, image_manager):
largest_line_number = 0
for path, item_type, other_path in collection:
if item_type == 'diff':
@ -377,7 +377,7 @@ def render_diff(collection, diff_map, args, columns):
if item_type == 'diff':
if is_binary:
if is_img:
ans = image_lines(path, other_path, columns, margin_size)
ans = image_lines(path, other_path, columns, margin_size, image_manager)
else:
ans = yield_lines_from(binary_lines(path, other_path, columns, margin_size), item_ref)
else:
@ -385,7 +385,7 @@ def render_diff(collection, diff_map, args, columns):
elif item_type == 'add':
if is_binary:
if is_img:
ans = image_lines(None, path, columns, margin_size)
ans = image_lines(None, path, columns, margin_size, image_manager)
else:
ans = yield_lines_from(binary_lines(None, path, columns, margin_size), item_ref)
else:
@ -393,7 +393,7 @@ def render_diff(collection, diff_map, args, columns):
elif item_type == 'removal':
if is_binary:
if is_img:
ans = image_lines(path, None, columns, margin_size)
ans = image_lines(path, None, columns, margin_size, image_manager)
else:
ans = yield_lines_from(binary_lines(path, None, columns, margin_size), item_ref)
else: