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
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.
- +0Prompt · +0Diagnose 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.
- +0mAgent did · +0mRead 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.
- +9mAgent did · +9mResearched 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.
- +31mPrompt · +31mAsked 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.
- +31mAgent did · +31mDrafted 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).
- +1h 20mPrompt · +1h 20mAsked to open a branch and implement a solution binding cmd+shift+v for raw paste directly in pi-mono, then build and test locally.
- +1h 21mAgent did · +1h 21mCreated 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.
- +1h 27mFail · +1h 27mpi-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.
- Break · 1h 31m away, not counted
- +1h 48mIntervention · +1h 48mAfter 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.
- +1h 54mFail · +1h 54mFirst 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.
- +2h 10mOutcome · +2h 10mCleaned 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.
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.