mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-23 16:58:09 +02:00
Report support for OSC52 write to clipboard in DA1
There are apparently some applications that want to only turn on OSC52 if they can be sure the terminal supports it. https://github.com/contour-terminal/vt-extensions/blob/master/clipboard-extension.md Seems harmless enough, though IMO the correct query mechanism for runtime controllable settings is XTGETTCAP, but, let's be a good citizen and co-operate. The overhead is not too large and I have more important windmills to tilt at. Fixes #8788
This commit is contained in:
@@ -24,7 +24,7 @@ from kitty.options.types import Options, defaults
|
||||
from kitty.rgb import to_color
|
||||
from kitty.types import MouseEvent
|
||||
from kitty.utils import read_screen_size
|
||||
from kitty.window import decode_cmdline, process_remote_print, process_title_from_child
|
||||
from kitty.window import da1, decode_cmdline, process_remote_print, process_title_from_child
|
||||
|
||||
|
||||
def parse_bytes(screen, data, dump_callback=None):
|
||||
@@ -132,10 +132,14 @@ class Callbacks:
|
||||
self.last_cmd_cmdline = ''
|
||||
self.last_cmd_at = 0
|
||||
self.num_of_resize_events = 0
|
||||
self.da1 = []
|
||||
|
||||
def on_bell(self) -> None:
|
||||
self.bell_count += 1
|
||||
|
||||
def on_da1(self) -> None:
|
||||
self.da1.append(da1(get_options()))
|
||||
|
||||
def on_activity_since_last_focus(self) -> None:
|
||||
pass
|
||||
|
||||
|
||||
@@ -407,6 +407,15 @@ class TestScreen(BaseTest):
|
||||
parse_bytes(s, b'\x1b[?2048h') # ]
|
||||
self.ae(c.num_of_resize_events, 2)
|
||||
|
||||
def test_da1(self):
|
||||
s = self.create_screen()
|
||||
parse_bytes(s, b'\x1b[c\x1b[0c') # ]]
|
||||
self.ae(s.callbacks.da1, ['?62;52;c', '?62;52;c']) # ]]
|
||||
s.callbacks.clear()
|
||||
self.create_screen(options={'clipboard_control': 'read-clipboard'})
|
||||
parse_bytes(s, b'\x1b[c') # ]]
|
||||
self.ae(s.callbacks.da1, ['?62;c']) # ]]
|
||||
|
||||
def test_cursor_after_resize(self):
|
||||
|
||||
def draw(text, end_line=True):
|
||||
|
||||
Reference in New Issue
Block a user