def test_ResetColor_All(self): esccmd.ChangeColor("3", "?") original = escio.ReadOSC("4") esccmd.ChangeColor("3", "#aabbcc") esccmd.ChangeColor("3", "?") AssertEQ(escio.ReadOSC("4"), ";3;rgb:aaaa/bbbb/cccc") esccmd.ResetColor() esccmd.ChangeColor("3", "?") AssertEQ(escio.ReadOSC("4"), original)
def test_ResetColor_Standard(self): n = "0" esccmd.ChangeColor(n, "?") original = escio.ReadOSC("4") esccmd.ChangeColor(n, "#aaaabbbbcccc") esccmd.ChangeColor(n, "?") AssertEQ(escio.ReadOSC("4"), ";" + n + ";rgb:aaaa/bbbb/cccc") esccmd.ResetColor(n) esccmd.ChangeColor(n, "?") AssertEQ(escio.ReadOSC("4"), original)
def reset(): esccmd.DECSCL(60 + esc.vtLevel, 1) escio.use8BitControls = False esccmd.DECSTR() esccmd.XTERM_WINOPS(esccmd.WINOP_RESIZE_CHARS, 25, 80) esccmd.DECRESET(esccmd.OPT_ALTBUF) # Is this needed? esccmd.DECRESET(esccmd.OPT_ALTBUF_CURSOR) # Is this needed? esccmd.DECRESET(esccmd.ALTBUF) # Is this needed? esccmd.DECRESET( esccmd.DECLRMM ) # This can be removed when the bug revealed by test_DECSET_DECLRMM_ResetByDECSTR is fixed. esccmd.RM(esccmd.IRM) esccmd.RM(esccmd.LNM) # Technically, autowrap should be off by default (this is what the spec calls for). # However, xterm and iTerm2 turn it on by default. xterm has a comment that says: # There are a couple of differences from real DEC VTxxx terminals (to avoid # breaking applications which have come to rely on xterm doing # this)...autowrap mode should be reset (instead it's reset to the resource # default). esccmd.DECSET(esccmd.DECAWM) esccmd.DECRESET(esccmd.MoreFix) # Set and query title with utf-8 esccmd.RM_Title(0, 1) esccmd.SM_Title(2, 3) esccmd.ED(2) # Pop the title stack just in case something got left on there for _ in xrange(5): esccmd.XTERM_WINOPS(esccmd.WINOP_POP_TITLE, esccmd.WINOP_PUSH_TITLE_ICON_AND_WINDOW) # Clear tab stops and reset them at 1, 9, ... esccmd.TBC(3) width = escutil.GetScreenSize().width() x = 1 while x <= width: esccmd.CUP(esctypes.Point(x, 1)) esccmd.HTS() x += 8 esccmd.CUP(esctypes.Point(1, 1)) esccmd.XTERM_WINOPS(esccmd.WINOP_DEICONIFY) # Reset all colors. esccmd.ResetColor() # Work around a bug in reset colors where dynamic colors do not get reset. esccmd.ChangeDynamicColor("10", "#000") esccmd.ChangeDynamicColor("11", "#ffffff")