Repository navigation
Closed
Labels
enhancementNew feature or request
Description
What problem does this solve?
tole-tui does not handle terminal paste at all: there is no bracketed-paste handling (no paste event is read and the mode is never enabled), so a pasted block reaches the editor as individual key events. I have not verified what a multi-line paste does today; the likely failure is that the first newline is read as Enter and submits a half-pasted message. That needs a quick reproduction in the pty test harness before anything is changed.
There is also no way to attach an image in the TUI, and no clipboard access anywhere in the repository.
Proposed solution
Two separable parts, in this order:
- Paste (text). Enable bracketed paste and add a UI-neutral
Input::Paste(String)to the refactor(tui): separate UI state from terminal input and rendering; slim TuiHost #526 input seam, so the editor inserts the whole block as one edit (newlines stay newlines) and a GUI client can feed the same state machine. Start with a failing pty test that reproduces the current behavior, so the fix is proven rather than assumed. - Image attach. Pending images shown as a row above the editor (like the queued-message rows) and sent with the next message. Ways to add one:
/image <path>(and an@-panel entry): works everywhere, no new dependency; the path goes through the existing jail check.- Pasting a path or a
data:image/...URL is recognised and attached instead of inserted as text. - Decision needed: reading an image from the OS clipboard. Terminals cannot deliver image bytes through a paste event, so this needs a native clipboard dependency, which I would keep behind an optional cargo feature (off for embedders and
--no-default-features). The alternative is to not support it in the TUI at all and let the graphical clients (which have native clipboard APIs) own clipboard images.
Depends on images on any turn (#559); the shared upload/spill path is the same one the server uses (#558).
Alternatives considered
- Clipboard image support in the TUI by default: rejected, it adds a native dependency to every build for a feature terminals do not really support.
- Do nothing for paste: leaves multi-line paste fragile, which affects every user, not only image users.
Acceptance criteria
- A pty test reproduces the current paste behavior, then passes after the fix (multi-line paste inserts without submitting).
-
Input::Pasteis covered by a fake-host test with no crossterm types, anddocs/tui.md(keys and architecture) is updated. -
/image <path>attaches an image to the next message, refuses paths outside the jail, and shows the pending row; a non-vision model gives the same capability error as--image. - A recorded decision on OS clipboard images (feature flag vs not in the TUI).
Metadata
Metadata
Assignees
Labels
enhancementNew feature or request
Activity
feat(tui): bracketed paste and image attach (#560)
feat(tui): bracketed paste and image attach (#560) (#564)