Add some more commands to the client

This commit is contained in:
Kovid Goyal 2020-12-17 08:37:55 +05:30
parent 0e46e2a6a7
commit e7675e8bab
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -11,6 +11,7 @@
import sys
from contextlib import suppress
from typing import Any
from functools import partial
CSI = '\033['
@ -50,10 +51,26 @@ def screen_cursor_forward(amt: int) -> None:
write(CSI + '%sC' % amt)
def screen_save_cursor() -> None:
write('\x1b7')
def screen_restore_cursor() -> None:
write('\x1b8')
def screen_cursor_back1(amt: int) -> None:
write(CSI + '%sD' % amt)
def screen_save_modes() -> None:
write(CSI + '?s')
def screen_restore_modes() -> None:
write(CSI + '?r')
def screen_designate_charset(which: int, to: int) -> None:
w = '()'[int(which)]
t = chr(int(to))
@ -161,6 +178,10 @@ def report_device_attributes(mode: int, char: int) -> None:
write(CSI + x + 'c')
def screen_decsace(mode: int) -> None:
write(CSI + str(mode) + '*x')
def write_osc(code: int, string: str = '') -> None:
if string:
string = ';' + string
@ -168,6 +189,8 @@ def write_osc(code: int, string: str = '') -> None:
set_dynamic_color = set_color_table_color = write_osc
screen_push_dynamic_colors = partial(write_osc, 30001)
screen_pop_dynamic_colors = partial(write_osc, 30101)
def replay(raw: str) -> None: