Skip to content

fix(tui): Termux context-menu paste injects characters one at a time, breaking multiline input #583

Description

@PatrickNoFilter

Problem

On Termux (Android terminal), the long-press context menu paste injects characters one at a time, including newlines as raw KeyEnter events. This means pasting any multiline text submits on the first \n before the user can review or edit it.

The existing tea.PasteMsg (bracketed paste / Ctrl+Shift+V) works fine, but Termux context menu paste bypasses bracketed mode entirely.

Proposed fix

A timing-based paste detector that tracks consecutive keypresses within a 100ms window. When Enter arrives inside such a burst, it inserts a newline instead of submitting. The burst counter is reset at every intentional action boundary (submit, modal enter/exit, etc.) so normal typing is unaffected.

See PR #573 for the implementation.

Environment

  • Termux on Android ARM64
  • Any terminal app using long-press context menu paste

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions