Skip to content

Pasting with the terminal's own paste goes in as one paste - #480

Merged
jamescrosswell merged 1 commit into
mainfrom
feat/terminal-paste
Oct 9, 2026
Merged

jamescrosswell merged 1 commit into
mainfrom
feat/terminal-paste

Conversation

@a-team-app

@a-team-app a-team-app Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Pasting with the terminal's own paste (Cmd+V, right-click, middle-click) now goes in as one paste everywhere Ctrl+V does. An indented block keeps its indentation exactly, one Ctrl+Z takes the whole paste out, a selection is replaced, and with several carets each one gets the paste the way Ctrl+V gives it to them: a line each when the counts match, otherwise all of it at every caret.

Closes #446

Notes for review:

  • Moving to Terminal.Gui 2.5 (Move TuiCode to Terminal.Gui 2.5 and MentalDesk.Tui 0.2.0 #472) already made a paste at one caret, and in the Find field or a dialog's text field, arrive as a single bracketed paste. What was missing was several carets, where a terminal paste went in at the primary caret only. The tests cover all of these.
  • Over SSH there's nothing extra for TuiCode to do: the laptop's terminal reads its own clipboard and sends the text as a bracketed paste, which arrives here the same way as a local one. That can't be covered by an automated test.
  • tuirec types literal text one key at a time, so it can't send a bracketed paste. I checked the built app in a raw pty instead, by writing the paste bytes in one go and saving: the block went in verbatim, one Ctrl+Z restored the file, and two carets got 1 and 2.

🤖 Generated with Claude Code

a-team try tuicode 480

TG 2.5 turns on bracketed paste and hands the focused view the whole block as
Command.Paste, with no key. At one caret that already went in verbatim, but
with several carets it skipped OnKeyDown's multi-caret paste and went in at
the primary caret only. EditorTextView.OnPaste now sends it through
PasteAtCarets (several carets) or EditAtPrimary (one), so it shares Ctrl+V's
behaviour and undo records the carets from before the paste.

Checked against the built app in a pty: an indented block keeps its
indentation, one Ctrl+Z takes it out, and two carets get a line each.

Closes #446

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@a-team-app
a-team-app Bot marked this pull request as ready for review October 8, 2026 22:37
@jamescrosswell
jamescrosswell merged commit fdb8a9f into main Oct 9, 2026
30 checks passed
@jamescrosswell
jamescrosswell deleted the feat/terminal-paste branch October 9, 2026 04:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Pasting with the terminal's own paste goes in as one paste

1 participant