Skip to content

Numpad keys not working in TUI prompt and dialogs #20461

Closed as not planned
Closed as not planned

Description

@rachavz

Problem

Numpad keys (0-9, Enter, operators, navigation) are not recognized in the TUI. This affects:

  1. Numpad Enter (kpenter) does not submit the prompt, confirm dialogs, or select options — only the main keyboard return key works.
  2. Numpad digits (0-9) are not inserted into the prompt input when using terminals that use the kitty keyboard protocol.
  3. Numpad navigation (Home, End, arrow keys via numpad) does not move the cursor in the input field.

Root Cause

The TUI keybinding system only recognizes return as the Enter key and does not account for numpad-specific key names from the kitty keyboard protocol (kpenter, kpequal, kp0-kp9, etc.) or legacy SS3 escape sequences.

Changes

  • keybind.ts: Add isEnterKey() helper that accepts return, kpenter, and kpequal. Add detectNumpadKeyName() in Keybind.fromParsedKey() to detect numpad keys from kitty protocol names, legacy SS3 sequences, and modifyOtherKeys CSI-u codes.
  • config.ts: Add numpad key equivalents to all input keybinding defaults (kpenter/kpequal for submit, kp0-kp9 for digits, kp4/kp6/kp8/kp2 for arrows, kp7/kp9/kphome/kpend for Home/End, etc.).
  • prompt/index.tsx: Add handlers for kp0-kp9 and numpad operators (/, *, -, +, ., =) to insert the corresponding characters.
  • Dialogs: Replace all evt.name === "return" checks with isEnterKey(evt) across dialog-alert, dialog-confirm, dialog-export-options, dialog-help, dialog-prompt, dialog-select, permission.tsx, question.tsx, and autocomplete.tsx.

Affected Components

  • TUI prompt input
  • All dialogs (alert, confirm, prompt, select, help, export-options)
  • Permission prompts
  • Question prompts
  • Autocomplete

Environment

Windows terminals using kitty keyboard protocol and terminals that send legacy SS3 sequences for numpad keys.

Activity

  1. added
    opentuiThis relates to changes in v1.0, now that opencode uses opentui
    on Apr 1, 2026
  2. github-actions commented on Apr 1, 2026

    @github-actions
    Contributor

    This issue doesn't fully meet our contributing guidelines.

    What needs to be fixed:

    • No issue template was used. Please use one of the three required templates: Bug Report, Feature Request, or Question.
    • The issue reads like a PR/implementation proposal (describing specific code changes, helper functions, and file edits) rather than a bug report. Please focus on describing the problem, steps to reproduce, and your environment — not the proposed fix.
    • The level of detail and structure suggests AI-generated content, which is not acceptable per our guidelines.

    Please edit this issue to address the above within 2 hours, or it will be automatically closed.


    This issue might be a duplicate of existing issues. Please check:

    For keybind-related issues, please also check our pinned keybinds documentation: #4997

    If you believe this was flagged incorrectly, please let a maintainer know.

  3. self-assigned this
    on Apr 1, 2026
  4. github-actions commented on Apr 1, 2026

    @github-actions
    Contributor

    This issue has been automatically closed because it was not updated to meet our contributing guidelines within the 2-hour window.

    Feel free to open a new issue that follows our issue templates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

opentuiThis relates to changes in v1.0, now that opencode uses opentui

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions