Skip to content

Textarea ignores numeric keypad input #1041

@pgassmann

Description

@pgassmann

Summary

OpenTUI textarea/input handling ignores numeric keypad keys. This is visible in opencode TUI: top-row digits work, but the entire numpad is ignored, including digits, operators, and numpad Enter.

Environment

  • OS: macOS
  • Terminals tested: iTerm2 and VS Code integrated terminal
  • App observed: opencode TUI
  • OpenTUI version used by opencode: 0.2.5

Reproduction

  1. Open opencode TUI.
  2. Focus the prompt textarea.
  3. Press top-row number keys: digits are inserted.
  4. Press numpad keys: 0-9, +, -, /, *, and numpad Enter are ignored.

Expected behavior

Numeric keypad keys should behave like their regular equivalents in text input:

  • 0-9 insert digits
  • . inserts decimal point
  • /, *, -, + insert operators
  • numpad Enter behaves like regular Enter / submit

Actual behavior

Numpad keys do nothing in the textarea/prompt.

Technical notes

opencode enables OpenTUI keyboard handling with:

useKittyKeyboard: {},

OpenTUI already recognizes keypad key names such as kp0, kp1, kpplus, and kpenter in packages/core/src/lib/parse.keypress-kitty.ts, and the keymap parser lists those names in packages/keymap/src/addons/universal/default-parser.ts.

The missing piece appears to be textarea normalization. Textarea.handleKeyPress() in packages/core/src/renderables/Textarea.ts special-cases space and otherwise inserts printable key.sequence, but it does not translate kp* key names into text/actions.

Suggested behavior:

  • kp0-kp9 -> 0-9
  • kpdecimal -> .
  • kpdivide -> /
  • kpmultiply -> *
  • kpminus -> -
  • kpplus -> +
  • kpenter -> regular Enter / submit

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions