diff --git a/kitty/boss.py b/kitty/boss.py index 748129f7e..961d00242 100644 --- a/kitty/boss.py +++ b/kitty/boss.py @@ -304,16 +304,11 @@ def __call__(self, window_id: int, what: str, *a: Any) -> None: if self.draw_dump_buf: safe_print('draw', ''.join(self.draw_dump_buf)) self.draw_dump_buf = [] - def encode_dict_value(v: Any) -> Any: - if isinstance(v, (bytes, memoryview)): - return str(v, 'utf-8', 'replace') - return v - def fmt(x: Any) -> Any: if isinstance(x, (bytes, memoryview)): return str(x, 'utf-8', 'replace') if isinstance(x, dict): - return json.dumps({k: encode_dict_value(v) for k, v in x.items()}) + return json.dumps({k: fmt(v) for k, v in x.items()}) return x safe_print(what, *map(fmt, a), flush=True) # }}} diff --git a/kitty/client.py b/kitty/client.py index 871fe0b71..ea3676181 100644 --- a/kitty/client.py +++ b/kitty/client.py @@ -289,7 +289,7 @@ def dnd_command(payload: str) -> None: m += f':m={more}' if (client_id := c.pop('client_id', None)): m += f':i={client_id}' - if (operation := c.pop('operation', None)) is not None and operation: + if (operation := c.pop('operation', None)): m += f':o={operation}' if (cell_x := c.pop('cell_x', None)): m += f':x={cell_x}'