Skip to content

Terminal keyboard input support #163

@sunfishcode

Description

@sunfishcode

Along with ANSI escape sequences for display, we should also consider escape sequences for input, so that arrow keys, function keys, page-up/page-down/home/end/etc. can be used.

Assuming we take the approach in #162 of avoiding exposing the termcap/terminfo/TERM information to applications, it seems logical to the same thing for inputs, and just define escape sequences used by WASI, and have implementations translate into those sequences.

At the risk of being too cute, in the Unicode era, we could have quite descriptive sequences, something like this:

Escape sequence Meaning
␛↑ up arrow
␛← left arrow
␛↓ down arrow
␛→ right arrow
␛⁽¹⁾ F1
␛⁽¹²⁾ F12
␛⌦ Delete
␛⎀ Insert

and so on, with "␛" here representing an actual ESC control character, so we can distinguish between the user entering a literal unicode symbol and pressing one of these special keys.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions