Пример #1
0
    def doModifiableAnsiTest(self, mode):
        before = self.requestAnsiMode(mode)
        if before[1] == 2:
            esccmd.SM(mode)
            AssertEQ(self.requestAnsiMode(mode), [mode, 1])

            esccmd.RM(mode)
            AssertEQ(self.requestAnsiMode(mode), [mode, 2])
        else:
            esccmd.RM(mode)
            AssertEQ(self.requestAnsiMode(mode), [mode, 2])

            esccmd.SM(mode)
            AssertEQ(self.requestAnsiMode(mode), [mode, 1])
Пример #2
0
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")
Пример #3
0
  def doLinefeedModeTest(self, code):
    esccmd.RM(esccmd.LNM)
    esccmd.CUP(Point(5, 1))
    escio.Write(code)
    AssertEQ(GetCursorPosition(), Point(5, 2))

    esccmd.SM(esccmd.LNM)
    esccmd.CUP(Point(5, 1))
    escio.Write(code)
    AssertEQ(GetCursorPosition(), Point(1, 2))
Пример #4
0
    def test_RM_IRM(self):
        # First turn on insert mode
        esccmd.SM(esccmd.IRM)
        esccmd.CUP(Point(1, 1))
        escio.Write("X")
        esccmd.CUP(Point(1, 1))
        escio.Write("W")

        # Now turn on replace mode
        esccmd.CUP(Point(1, 1))
        esccmd.RM(esccmd.IRM)
        escio.Write("YZ")
        AssertScreenCharsInRectEqual(Rect(1, 1, 2, 1), ["YZ"])
Пример #5
0
    def test_SaveRestoreCursor_InsertNotAffected(self):
        # Turn on insert and save
        esccmd.SM(esccmd.IRM)
        self.saveCursor()

        # Turn off insert and restore. Restore should turn insert on.
        esccmd.RM(esccmd.IRM)
        self.restoreCursor()

        # See if insert is still off
        esccmd.CUP(Point(1, 1))
        escio.Write("a")
        esccmd.CUP(Point(1, 1))
        escio.Write("b")
        AssertScreenCharsInRectEqual(Rect(1, 1, 2, 1), ["b" + empty()])