mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-20 23:44:59 +02:00
Pass the image manager to the render code
This commit is contained in:
@@ -68,7 +68,7 @@ class DiffHandler(Handler):
|
|||||||
self.start_job('diff', generate_diff, self.collection, self.current_context_count)
|
self.start_job('diff', generate_diff, self.collection, self.current_context_count)
|
||||||
|
|
||||||
def render_diff(self):
|
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)
|
self.ref_path_map = defaultdict(list)
|
||||||
for i, l in enumerate(self.diff_lines):
|
for i, l in enumerate(self.diff_lines):
|
||||||
self.ref_path_map[l.ref.path].append((i, l.ref))
|
self.ref_path_map[l.ref.path].append((i, l.ref))
|
||||||
|
|||||||
@@ -353,12 +353,12 @@ def rename_lines(path, other_path, args, columns, margin_size):
|
|||||||
yield m + line
|
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:
|
if False:
|
||||||
yield 0
|
yield 0
|
||||||
|
|
||||||
|
|
||||||
def render_diff(collection, diff_map, args, columns):
|
def render_diff(collection, diff_map, args, columns, image_manager):
|
||||||
largest_line_number = 0
|
largest_line_number = 0
|
||||||
for path, item_type, other_path in collection:
|
for path, item_type, other_path in collection:
|
||||||
if item_type == 'diff':
|
if item_type == 'diff':
|
||||||
@@ -377,7 +377,7 @@ def render_diff(collection, diff_map, args, columns):
|
|||||||
if item_type == 'diff':
|
if item_type == 'diff':
|
||||||
if is_binary:
|
if is_binary:
|
||||||
if is_img:
|
if is_img:
|
||||||
ans = image_lines(path, other_path, columns, margin_size)
|
ans = image_lines(path, other_path, columns, margin_size, image_manager)
|
||||||
else:
|
else:
|
||||||
ans = yield_lines_from(binary_lines(path, other_path, columns, margin_size), item_ref)
|
ans = yield_lines_from(binary_lines(path, other_path, columns, margin_size), item_ref)
|
||||||
else:
|
else:
|
||||||
@@ -385,7 +385,7 @@ def render_diff(collection, diff_map, args, columns):
|
|||||||
elif item_type == 'add':
|
elif item_type == 'add':
|
||||||
if is_binary:
|
if is_binary:
|
||||||
if is_img:
|
if is_img:
|
||||||
ans = image_lines(None, path, columns, margin_size)
|
ans = image_lines(None, path, columns, margin_size, image_manager)
|
||||||
else:
|
else:
|
||||||
ans = yield_lines_from(binary_lines(None, path, columns, margin_size), item_ref)
|
ans = yield_lines_from(binary_lines(None, path, columns, margin_size), item_ref)
|
||||||
else:
|
else:
|
||||||
@@ -393,7 +393,7 @@ def render_diff(collection, diff_map, args, columns):
|
|||||||
elif item_type == 'removal':
|
elif item_type == 'removal':
|
||||||
if is_binary:
|
if is_binary:
|
||||||
if is_img:
|
if is_img:
|
||||||
ans = image_lines(path, None, columns, margin_size)
|
ans = image_lines(path, None, columns, margin_size, image_manager)
|
||||||
else:
|
else:
|
||||||
ans = yield_lines_from(binary_lines(path, None, columns, margin_size), item_ref)
|
ans = yield_lines_from(binary_lines(path, None, columns, margin_size), item_ref)
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user