clipboard kitten: fix copies to clipboard not working without the --wait-for-completion option
This commit is contained in:
parent
31da01d4df
commit
ff191c9404
@ -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]
|
||||
----------------------
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
@ -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):
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user