Skip to content

Commit e7675e8

Browse files
committed
Add some more commands to the client
1 parent 0e46e2a commit e7675e8

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

kitty/client.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import sys
1212
from contextlib import suppress
1313
from typing import Any
14+
from functools import partial
1415

1516

1617
CSI = '\033['
@@ -50,10 +51,26 @@ def screen_cursor_forward(amt: int) -> None:
5051
write(CSI + '%sC' % amt)
5152

5253

54+
def screen_save_cursor() -> None:
55+
write('\x1b7')
56+
57+
58+
def screen_restore_cursor() -> None:
59+
write('\x1b8')
60+
61+
5362
def screen_cursor_back1(amt: int) -> None:
5463
write(CSI + '%sD' % amt)
5564

5665

66+
def screen_save_modes() -> None:
67+
write(CSI + '?s')
68+
69+
70+
def screen_restore_modes() -> None:
71+
write(CSI + '?r')
72+
73+
5774
def screen_designate_charset(which: int, to: int) -> None:
5875
w = '()'[int(which)]
5976
t = chr(int(to))
@@ -161,13 +178,19 @@ def report_device_attributes(mode: int, char: int) -> None:
161178
write(CSI + x + 'c')
162179

163180

181+
def screen_decsace(mode: int) -> None:
182+
write(CSI + str(mode) + '*x')
183+
184+
164185
def write_osc(code: int, string: str = '') -> None:
165186
if string:
166187
string = ';' + string
167188
write(OSC + str(code) + string + '\x07')
168189

169190

170191
set_dynamic_color = set_color_table_color = write_osc
192+
screen_push_dynamic_colors = partial(write_osc, 30001)
193+
screen_pop_dynamic_colors = partial(write_osc, 30101)
171194

172195

173196
def replay(raw: str) -> None:

0 commit comments

Comments
 (0)