Ctrl+G should expand paste tokens to full text in $EDITOR (Claude Code parity)
- Ngôn ngữ chính
- Shell
- Star
- 11.2k
- Fork
- 1.9k
- Merge trung bình
- 14 giờ 16 phút
- Pull request đã merge (30 ngày)
- 6
Mô tả
### Describe the feature or problem you'd like to solve
When `compactPaste` is enabled (the default), pasting a large block collapses it in the compose box to a token like `[Paste #N - X lines]`. Pressing **Ctrl+G** ("edit prompt in `$EDITOR`") writes that **literal token** to the temp file, so I can't see or edit the actual pasted content in my external editor — I only see the placeholder. This is especially painful when using dictation software: I paste a long prompt and want to review/edit it in my editor before sending.
For comparison, Claude Code keeps the compact representation in the prompt box but expands it to the **full text** when you open the external editor.
### Proposed solution
When opening the prompt in `$EDITOR` via Ctrl+G, expand any paste tokens (`[Paste #N - X lines]` and `[Saved pasted content to workspace (...) id=N]`) to their full underlying text before writing the temp file. On save, ideally re-collapse the content back into tokens (or simply keep whatever text the user left).
This gives the best of both: a clean, compact compose box **and** a fully editable prompt in the external editor.
Today it's all-or-nothing via the `compactPaste` setting:
- `compactPaste: true` → compact box, but Ctrl+G shows only the token.
- `compactPaste: false` → Ctrl+G shows full text, but the box is no longer compact.
There's no way to get compact-in-box **and** full-text-in-editor at the same time.
### Example prompts or workflows
1. Dictate a 40-line prompt with speech-to-text, paste it (shows as `[Paste #1 - 40 lines]`), press Ctrl+G, and edit the full text in my editor before sending.
2. Paste a long log / stack trace, collapse it for a tidy box, then Ctrl+G to trim it down in `$EDITOR`.
3. Paste several large snippets (multiple tokens), open Ctrl+G once, and review / reorder them all as full text.
4. Compose a long multi-paragraph instruction across several pastes, then do a final full-text review in Vim / VS Code via Ctrl+G.
### Additional context
Observed in **v1.0.65** on **Windows (arm64)** with `EDITOR=notepad`.
From the bundled `app.js`, the Ctrl+G handler passes the raw compose-box buffer (with tokens) directly to the editor:
```js
// Ctrl+G handler
let cr = () => ot(Gn.text).then(({ content }) => Gn.setText(content));
```
The token-expansion function exists but is only invoked at **submit** time (replacing `[Paste #N]` with the in-memory text and `[Saved pasted content ...]` with a `` reference). It is not called — and isn't in scope — at the Ctrl+G handler. Routing Ctrl+G's input through that same expander would deliver this feature.
Hướng dẫn đóng góp
Hướng nghiên cứu
Đọc handler Ctrl+G và đường dẫn mở rộng token hiện có trong app.js đã được bundle. Tái hiện thao tác paste nhỏ gọn, mở $EDITOR và xác minh rằng các paste token trở thành toàn bộ văn bản của chúng trong trình soạn thảo, đồng thời nội dung đã chỉnh sửa quay lại luồng compose. Hoàn tất khi nhiều paste token, bao gồm cả nội dung đã paste được lưu, được xử lý qua workflow này.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- javascript
- Lĩnh vực
- cli, developer-experience
- Loại issue
- Tính năng
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức độ hoạt động
- Ít trao đổi
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 68/100