Skip to content
Pi · gpt-5.2-codexdebugCLI & tooling11 files · +398 −120

Diagnose and add raw-paste support for pi TUI (bypass paste markers)

Session from pi-extensions-sessions on Hugging Face by thomasmustier · MIT · condensed by Coders Talk

2h 10msession
1interventions
GOAL

Investigate why large pastes in pi get mangled/collapsed into placeholders (GitHub issue #561 and related), and build a way to paste raw text on demand instead of the default truncated/marker paste behavior.

  1. Prompt · +0
    Diagnose why pasted text of a certain length gets malformatted in pi, referencing GH issue #561; also asked whether raw paste (edit before send) is possible.
  2. Agent did · +0m
    Read the issue, searched the codebase for paste handling, and explained that large pastes (>10 lines/1000 chars) are collapsed into markers in packages/tui/src/components/editor.ts, with no raw-paste shortcut currently and ctrl+g external editor as the only workaround.
  3. Agent did · +9m
    Researched how Claude Code and Codex handle large pastes via GitHub issues; found both also collapse pastes into placeholders with no maintainer rationale for disallowing raw paste, and no open pi issue on the topic.
  4. Prompt · +31m
    Asked to draft (not submit) a GitHub feature-proposal issue for optional raw paste, including deciding on a keybinding (ctrl+shift+v/cmd+shift+v) and implementation approach.
  5. Agent did · +31m
    Drafted the issue, then tested key handling across the user's terminals (Warp, Ghostty, Terminal.app) via a key-dump script, discovering that Cmd+Shift+V is intercepted as paste by all three, and Ctrl+Shift+V only produces a distinguishable Kitty sequence in Ghostty (as ctrl+alt+v, not ctrl+shift+v).
  6. Prompt · +1h 20m
    Asked to open a branch and implement a solution binding cmd+shift+v for raw paste directly in pi-mono, then build and test locally.
  7. Agent did · +1h 21m
    Created branch feature/raw-paste-cmd-shift-v, added cmd modifier support to the key parser, added a one-shot raw-paste flag to the editor, and wired cmd+shift+v in custom-editor.ts to skip the paste-marker path.
  8. Fail · +1h 27m
    pi-dev-build command didn't exist on the machine, and once a build script was added, npm run check failed with a missing @crosscopy/clipboard module until npm install was run.
  9. Break · 1h 31m away, not counted
  10. Intervention · +1h 48m
    After confirming the terminal-level keybinding approach couldn't work reliably in Terminal.app/Warp, the developer redirected the approach entirely: build a pi extension in ~/pi-extensions/ instead of patching pi-mono core.
    Why: The cmd+shift+v approach kept hitting terminal interception; a user-space extension with a slash command was a more reliable, portable fix than patching core key handling.
  11. Fail · +1h 54m
    First extension version errored (setRawPasteOnce is not a function), and after rewriting it to intercept paste directly, a second bug caused the first line of pasted text to auto-submit before the fix normalized \r\n line endings.
  12. Outcome · +2h 10m
    Cleaned up and documented the working raw-paste extension in ~/pi-extensions, committed it to a 'rawpaste' branch and pushed; separately split unrelated tab-status/tab-status-bar changes into a rebased 'stab-status-bar' branch, both pushed to origin.
VERDICT

Next time I'd start by asking the agent to test actual terminal key-forwarding behavior before proposing a keybinding fix inside pi-mono core, since Cmd+Shift+V/Ctrl+Shift+V turned out to be intercepted by every terminal I use. The intervention that mattered was pivoting from patching pi-mono internals to building a standalone extension in ~/pi-extensions with a /rawpaste command — that sidestepped the terminal interception problem entirely and actually worked once we fixed the line-ending bug.

I tried this · 0

Discussion · 0

How Builds work