From c82f6aea95cebee45ccf5c8764c6f003e206e149 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 24 Nov 2016 13:38:24 +0530 Subject: [PATCH] Consolidate consecutive draw calls when dumping --- kitty/boss.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/kitty/boss.py b/kitty/boss.py index 3e3855e4d..39773ca3f 100644 --- a/kitty/boss.py +++ b/kitty/boss.py @@ -58,7 +58,8 @@ def __init__(self, window, window_width, window_height, opts, args, child): self.profile = args.profile self.window, self.opts = window, opts self.screen = Screen(self, 24, 80, opts.scrollback_lines) - self.read_bytes = partial(read_bytes_dump, print) if args.dump_commands else read_bytes + self.read_bytes = partial(read_bytes_dump, self.dump_commands) if args.dump_commands else read_bytes + self.draw_dump_buf = [] self.write_buf = memoryview(b'') self.char_grid = CharGrid(self.screen, opts, window_width, window_height) glfw.glfwSetCharModsCallback(window, self.on_text_input) @@ -66,6 +67,16 @@ def __init__(self, window, window_width, window_height, opts, args, child): glfw.glfwSetMouseButtonCallback(window, self.on_mouse_button) glfw.glfwSetWindowFocusCallback(window, self.on_focus) + def dump_commands(self, *a): + if a: + if a[0] == 'draw': + self.draw_dump_buf.append(a[1]) + else: + if self.draw_dump_buf: + print('draw', ''.join(self.draw_dump_buf)) + self.draw_dump_buf = [] + print(*a) + def queue_action(self, func, *args): self.action_queue.put((func, args)) self.wakeup()