Implement changing of default colors

This commit is contained in:
Kovid Goyal
2016-10-21 13:12:06 +05:30
parent fedfdf00a9
commit f25abac41d
3 changed files with 53 additions and 16 deletions

View File

@@ -127,7 +127,7 @@ class Stream(object):
events = frozenset(itertools.chain(
basic.values(), escape.values(), sharp.values(), csi.values(),
["define_charset", "select_other_charset"],
["set_icon", "set_title", 'set_cursor_color'], # OSC.
["set_icon", "set_title", 'set_dynamic_color'], # OSC.
["draw", "debug"]))
#: A regular expression pattern matching everything what can be
@@ -338,14 +338,21 @@ class Stream(object):
param.extend(char)
param = bytes(param)
if code in b"01":
listener.set_icon_name(param)
if code in b"02":
try:
code = int(code)
except Exception:
code = None
if code == 0:
listener.set_title(param)
elif code == b"12":
listener.set_cursor_color(param)
elif code == b"112":
listener.set_cursor_color(b'')
listener.set_icon_name(param)
elif code == 1:
listener.set_icon_name(param)
elif code == 2:
listener.set_title(param)
elif 9 < code < 20:
listener.set_dynamic_color(code, param)
elif 109 < code < 120:
listener.set_dynamic_color(code)
elif char == DCS:
# See http://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Device-Control-functions
code = yield