How to use the ytcc.terminal.Keys function in ytcc

To help you get started, we’ve selected a few ytcc examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github woefe / ytcc / ytcc / terminal.py View on Github external
# https://invisible-island.net/xterm/xterm-function-keys.html
_KNOWN_KEYS = {
    # vt100
    "\x1bOP": Keys.F1,
    "\x1bOQ": Keys.F2,
    "\x1bOR": Keys.F3,
    "\x1bOS": Keys.F4,
    "\x1bOt": Keys.F5,
    "\x1bOu": Keys.F6,
    "\x1bOv": Keys.F7,

    # rxvt
    "\x1b[11~": Keys.F1,
    "\x1b[12~": Keys.F2,
    "\x1b[13~": Keys.F3,
    "\x1b[14~": Keys.F4,
    "\x1b[15~": Keys.F5,
    "\x1b[17~": Keys.F6,
    "\x1b[18~": Keys.F7,

    # linux
    "\x1b[[A": Keys.F1,
    "\x1b[[B": Keys.F2,
    "\x1b[[C": Keys.F3,
    "\x1b[[D": Keys.F4,
    "\x1b[[E": Keys.F5,
}

_PREFIXES = {
    escape_sequence[:i]
    for escape_sequence in _KNOWN_KEYS
github woefe / ytcc / ytcc / terminal.py View on Github external
F3 = ""
    F4 = ""
    F5 = ""
    F6 = ""
    F7 = ""


# https://invisible-island.net/xterm/xterm-function-keys.html
_KNOWN_KEYS = {
    # vt100
    "\x1bOP": Keys.F1,
    "\x1bOQ": Keys.F2,
    "\x1bOR": Keys.F3,
    "\x1bOS": Keys.F4,
    "\x1bOt": Keys.F5,
    "\x1bOu": Keys.F6,
    "\x1bOv": Keys.F7,

    # rxvt
    "\x1b[11~": Keys.F1,
    "\x1b[12~": Keys.F2,
    "\x1b[13~": Keys.F3,
    "\x1b[14~": Keys.F4,
    "\x1b[15~": Keys.F5,
    "\x1b[17~": Keys.F6,
    "\x1b[18~": Keys.F7,

    # linux
    "\x1b[[A": Keys.F1,
    "\x1b[[B": Keys.F2,
    "\x1b[[C": Keys.F3,
    "\x1b[[D": Keys.F4,
github woefe / ytcc / ytcc / terminal.py View on Github external
"\x1bOt": Keys.F5,
    "\x1bOu": Keys.F6,
    "\x1bOv": Keys.F7,

    # rxvt
    "\x1b[11~": Keys.F1,
    "\x1b[12~": Keys.F2,
    "\x1b[13~": Keys.F3,
    "\x1b[14~": Keys.F4,
    "\x1b[15~": Keys.F5,
    "\x1b[17~": Keys.F6,
    "\x1b[18~": Keys.F7,

    # linux
    "\x1b[[A": Keys.F1,
    "\x1b[[B": Keys.F2,
    "\x1b[[C": Keys.F3,
    "\x1b[[D": Keys.F4,
    "\x1b[[E": Keys.F5,
}

_PREFIXES = {
    escape_sequence[:i]
    for escape_sequence in _KNOWN_KEYS
    for i in range(1, len(escape_sequence) + 1)
}


def _read_sequence(stream) -> str:
    seq = stream.read(1)
    if seq == "\x1b":
        while seq not in _KNOWN_KEYS and seq in _PREFIXES:
github woefe / ytcc / ytcc / terminal.py View on Github external
"\x1bOS": Keys.F4,
    "\x1bOt": Keys.F5,
    "\x1bOu": Keys.F6,
    "\x1bOv": Keys.F7,

    # rxvt
    "\x1b[11~": Keys.F1,
    "\x1b[12~": Keys.F2,
    "\x1b[13~": Keys.F3,
    "\x1b[14~": Keys.F4,
    "\x1b[15~": Keys.F5,
    "\x1b[17~": Keys.F6,
    "\x1b[18~": Keys.F7,

    # linux
    "\x1b[[A": Keys.F1,
    "\x1b[[B": Keys.F2,
    "\x1b[[C": Keys.F3,
    "\x1b[[D": Keys.F4,
    "\x1b[[E": Keys.F5,
}

_PREFIXES = {
    escape_sequence[:i]
    for escape_sequence in _KNOWN_KEYS
    for i in range(1, len(escape_sequence) + 1)
}


def _read_sequence(stream) -> str:
    seq = stream.read(1)
    if seq == "\x1b":
github woefe / ytcc / ytcc / terminal.py View on Github external
F2 = ""
    F3 = ""
    F4 = ""
    F5 = ""
    F6 = ""
    F7 = ""


# https://invisible-island.net/xterm/xterm-function-keys.html
_KNOWN_KEYS = {
    # vt100
    "\x1bOP": Keys.F1,
    "\x1bOQ": Keys.F2,
    "\x1bOR": Keys.F3,
    "\x1bOS": Keys.F4,
    "\x1bOt": Keys.F5,
    "\x1bOu": Keys.F6,
    "\x1bOv": Keys.F7,

    # rxvt
    "\x1b[11~": Keys.F1,
    "\x1b[12~": Keys.F2,
    "\x1b[13~": Keys.F3,
    "\x1b[14~": Keys.F4,
    "\x1b[15~": Keys.F5,
    "\x1b[17~": Keys.F6,
    "\x1b[18~": Keys.F7,

    # linux
    "\x1b[[A": Keys.F1,
    "\x1b[[B": Keys.F2,
    "\x1b[[C": Keys.F3,
github woefe / ytcc / ytcc / terminal.py View on Github external
F1 = ""
    F2 = ""
    F3 = ""
    F4 = ""
    F5 = ""
    F6 = ""
    F7 = ""


# https://invisible-island.net/xterm/xterm-function-keys.html
_KNOWN_KEYS = {
    # vt100
    "\x1bOP": Keys.F1,
    "\x1bOQ": Keys.F2,
    "\x1bOR": Keys.F3,
    "\x1bOS": Keys.F4,
    "\x1bOt": Keys.F5,
    "\x1bOu": Keys.F6,
    "\x1bOv": Keys.F7,

    # rxvt
    "\x1b[11~": Keys.F1,
    "\x1b[12~": Keys.F2,
    "\x1b[13~": Keys.F3,
    "\x1b[14~": Keys.F4,
    "\x1b[15~": Keys.F5,
    "\x1b[17~": Keys.F6,
    "\x1b[18~": Keys.F7,

    # linux
    "\x1b[[A": Keys.F1,
    "\x1b[[B": Keys.F2,
github woefe / ytcc / ytcc / terminal.py View on Github external
F4 = ""
    F5 = ""
    F6 = ""
    F7 = ""


# https://invisible-island.net/xterm/xterm-function-keys.html
_KNOWN_KEYS = {
    # vt100
    "\x1bOP": Keys.F1,
    "\x1bOQ": Keys.F2,
    "\x1bOR": Keys.F3,
    "\x1bOS": Keys.F4,
    "\x1bOt": Keys.F5,
    "\x1bOu": Keys.F6,
    "\x1bOv": Keys.F7,

    # rxvt
    "\x1b[11~": Keys.F1,
    "\x1b[12~": Keys.F2,
    "\x1b[13~": Keys.F3,
    "\x1b[14~": Keys.F4,
    "\x1b[15~": Keys.F5,
    "\x1b[17~": Keys.F6,
    "\x1b[18~": Keys.F7,

    # linux
    "\x1b[[A": Keys.F1,
    "\x1b[[B": Keys.F2,
    "\x1b[[C": Keys.F3,
    "\x1b[[D": Keys.F4,
    "\x1b[[E": Keys.F5,