mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-20 23:44:59 +02:00
clipboard kitten: fix copies to clipboard not working without the --wait-for-completion option
This commit is contained in:
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user