Implement SGR

This commit is contained in:
Kovid Goyal
2016-11-17 08:34:55 +05:30
parent f5fa40de81
commit f56da9392c
5 changed files with 175 additions and 17 deletions

View File

@@ -76,4 +76,20 @@ class TestScreen(BaseTest):
pb('\033[J', ('screen_erase_in_display', 0, 0))
pb('\033[?J', ('screen_erase_in_display', 0, 1))
pb('\033[?2J', ('screen_erase_in_display', 2, 1))
pb('\033[h')
pb('\033[20;4h', ('screen_set_mode', 20), ('screen_set_mode', 4))
pb('\033[?20;5h', ('screen_set_mode', 20 << 5), ('screen_set_mode', 5 << 5))
pb('\033[20;4;145l', ('screen_reset_mode', 20), ('screen_reset_mode', 4), ('screen_reset_mode', 145))
s.reset()
pb('\033[1;3;4;7;9;34;44m', ('select_graphic_rendition', 7))
for attr in 'bold italic reverse strikethrough'.split():
self.assertTrue(getattr(s.cursor, attr))
self.ae(s.cursor.decoration, 1)
self.ae(s.cursor.fg, 34 << 8 | 1)
self.ae(s.cursor.bg, 44 << 8 | 1)
pb('\033[38;5;1;48;5;7m', ('select_graphic_rendition', 6))
self.ae(s.cursor.fg, 1 << 8 | 2)
self.ae(s.cursor.bg, 7 << 8 | 2)
pb('\033[38;2;1;2;3;48;2;7;8;9m', ('select_graphic_rendition', 10))
self.ae(s.cursor.fg, 1 << 24 | 2 << 16 | 3 << 8 | 3)
self.ae(s.cursor.bg, 7 << 24 | 8 << 16 | 9 << 8 | 3)