mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-27 10:41:58 +02:00
Fix mapping of remote_control not working for actions that yield generators
Fixes #3147
This commit is contained in:
@@ -46,6 +46,8 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
|
|||||||
interoperability. This means that doing a DECRC without a prior DECSC is now
|
interoperability. This means that doing a DECRC without a prior DECSC is now
|
||||||
undefined (:iss:`1264`)
|
undefined (:iss:`1264`)
|
||||||
|
|
||||||
|
- Fix mapping ``remote_control send-text`` not working (:iss:`3147`)
|
||||||
|
|
||||||
|
|
||||||
0.19.2 [2020-11-13]
|
0.19.2 [2020-11-13]
|
||||||
-------------------
|
-------------------
|
||||||
|
|||||||
@@ -10,7 +10,8 @@ from contextlib import suppress
|
|||||||
from functools import partial
|
from functools import partial
|
||||||
from gettext import gettext as _
|
from gettext import gettext as _
|
||||||
from typing import (
|
from typing import (
|
||||||
Any, Callable, Dict, Generator, Iterable, List, Optional, Tuple, Union
|
Any, Callable, Dict, Generator, Iterable, List, Optional, Tuple, Union,
|
||||||
|
cast
|
||||||
)
|
)
|
||||||
from weakref import WeakValueDictionary
|
from weakref import WeakValueDictionary
|
||||||
|
|
||||||
@@ -363,9 +364,17 @@ class Boss:
|
|||||||
c = command_for_name(cmd)
|
c = command_for_name(cmd)
|
||||||
opts, items = parse_subcommand_cli(c, items)
|
opts, items = parse_subcommand_cli(c, items)
|
||||||
payload = c.message_to_kitty(global_opts, opts, items)
|
payload = c.message_to_kitty(global_opts, opts, items)
|
||||||
c.response_from_kitty(self, self.active_window, PayloadGetter(c, payload if isinstance(payload, dict) else {}))
|
import types
|
||||||
except (Exception, SystemExit) as e:
|
if isinstance(cast(types.GeneratorType, payload), types.GeneratorType):
|
||||||
self.show_error(_('remote_control mapping failed'), str(e))
|
payloads = cast(types.GeneratorType, payload)
|
||||||
|
for x in payloads:
|
||||||
|
c.response_from_kitty(self, self.active_window, PayloadGetter(c, x if isinstance(x, dict) else {}))
|
||||||
|
else:
|
||||||
|
c.response_from_kitty(self, self.active_window, PayloadGetter(c, payload if isinstance(payload, dict) else {}))
|
||||||
|
except (Exception, SystemExit):
|
||||||
|
import traceback
|
||||||
|
tb = traceback.format_exc()
|
||||||
|
self.show_error(_('remote_control mapping failed'), tb)
|
||||||
|
|
||||||
def peer_message_received(self, msg_bytes: bytes) -> Optional[bytes]:
|
def peer_message_received(self, msg_bytes: bytes) -> Optional[bytes]:
|
||||||
cmd_prefix = b'\x1bP@kitty-cmd'
|
cmd_prefix = b'\x1bP@kitty-cmd'
|
||||||
|
|||||||
Reference in New Issue
Block a user