Skip to content

cli: Refuse pasted card text and group typing into fours #141

Open

Description

@BenWestgate

Two tester requests for typing card text in the CLI:

  • Refuse paste when confirming a card, unless an explicit flag marks a test run. Pasted text only proves the share was copied, not that the card was written correctly. gui: Correct a read-back mismatch in fixed boxes #109 already refuses paste in the GUI read-back.
  • Group typed text into fours as it is typed, the way the card shows it. Pasted text with spaces is accepted, but typing doesn't insert them. The tester also suggests entering one group or card row at a time, assuming 48 characters unless a flag sets another length.

The CLI reads with readline's input(), which can't tell pasted text from typed text or act on each key.

Paste (Ben's suggestion): separate the displayed groups with a non-breaking space (U+00A0) instead of an ASCII space. A keyboard doesn't type that character, so a confirmation entry containing one was pasted, and it can be rejected. Check the raw entry before whitespace is normalized, since Python's split() treats U+00A0 as whitespace. This fails open: if a terminal copies it as a plain space, the paste just isn't caught, and typed text is never rejected. Keep --plain and redirected output ASCII. Check that the Tails terminal copies U+00A0 unchanged.

Grouping while typing still needs reading the terminal key by key, or prompting one card row at a time. Weigh that code against the line budget.

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

    area: cliCommand-line interface behavior.enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions