Skip to content

Convert text keypad keys from their CSI-u codes to their text values #981

@stefanhaller

Description

@stefanhaller

It seems that terminals have different ways to report keypad keys when in CSI-u mode: ghostty reports them as their text (ASCII) equivalents, but iTerm2 and Alacritty report them as the private-area codes from this table. I'm not really sure which one is more correct, the spec is a little ambiguous about this (the Disambiguate escape codes section only mentions non-text keypad keys).

So currently, when pressing '0' on the keypad in iTerm2, tcell clients receive an event with KeyRune and a Str value of \ue037, which is not useful; these should be translated to their ASCII equivalents. Similarly, keypad enter is returned as KeyRune and Str \ue046, whereas I would expect to get KeyEnter. (I can translate these client-side of course, but I feel I shouldn't have to.)

I saw this TODO comment in the code, but this would only solve half the problem. This table is about non-text keypad keys (e.g. clear and enter), but the printable ones would need another translation table.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions