clipboard kitten: fix copies to clipboard not working without the --wait-for-completion option

This commit is contained in:
Kovid Goyal 2021-07-24 07:55:50 +05:30
parent 31da01d4df
commit ff191c9404
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
4 changed files with 13 additions and 1 deletions

View File

@ -67,6 +67,9 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
use the family name as the full face name of the regular font not working
(:iss:`3861`)
- clipboard kitten: fix copies to clipboard not working without the
:option:`kitty +kitten clipboard --wait-for-completion` option
0.21.2 [2021-06-28]
----------------------

View File

@ -19,6 +19,7 @@ class Clipboard(Handler):
self.args = args
self.clipboard_contents: Optional[str] = None
self.data_to_send = data_to_send
self.quit_on_write = False
def initialize(self) -> None:
if self.data_to_send is not None:
@ -30,10 +31,14 @@ class Clipboard(Handler):
self.print('\x1bP+q544e\x1b\\', end='')
self.print('Waiting for completion...')
return
self.quit_loop(0)
self.quit_on_write = True
return
self.cmd.request_from_clipboard(self.args.use_primary)
def on_writing_finished(self) -> None:
if self.quit_on_write:
self.quit_loop(0)
def on_clipboard_response(self, text: str, from_primary: bool = False) -> None:
self.clipboard_contents = text
self.quit_loop(0)

View File

@ -107,6 +107,9 @@ class Handler:
def on_eot(self) -> None:
pass
def on_writing_finished(self) -> None:
pass
def on_kitty_cmd_response(self, response: Dict) -> None:
pass

View File

@ -343,6 +343,7 @@ class Loop:
self.write_buf: List[bytes] = []
self.asycio_loop.remove_writer(fd)
self.waiting_for_writes = False
handler.on_writing_finished()
else:
consumed = 0
for i, buf in enumerate(self.write_buf):