[Terminal Chat] Copying a suggestion with multiple lines is pasted improperly #22295

Open
opened 2026-01-31 08:09:06 +00:00 by claunia · 1 comment
Owner

Originally created by @carlos-zamora on GitHub (Sep 20, 2024).

Originally assigned to: @PankajBhojwani on GitHub.

Let's say I get a suggestion like this:
{9622A310-14A4-4216-9B82-9CA6E515DAB1}

That results in this error when the copy button is pressed:
{CCEF8A26-34E6-42BA-BDE2-5DA2F95667C1}

Looks like we need to change how it's copied over to the terminal.

Originally created by @carlos-zamora on GitHub (Sep 20, 2024). Originally assigned to: @PankajBhojwani on GitHub. Let's say I get a suggestion like this: ![{9622A310-14A4-4216-9B82-9CA6E515DAB1}](https://github.com/user-attachments/assets/62867f20-82f5-454c-ab4f-5aac766ddc05) That results in this error when the copy button is pressed: ![{CCEF8A26-34E6-42BA-BDE2-5DA2F95667C1}](https://github.com/user-attachments/assets/79707738-c94e-49ca-8eb9-5416ebeba18b) Looks like we need to change how it's copied over to the terminal.
claunia added the Issue-BugNeeds-Tag-FixProduct-TerminalArea-Chat labels 2026-01-31 08:09:07 +00:00
Author
Owner

@AltitudeApps commented on GitHub (Apr 26, 2025):

You may have already thought of this, but for anyone else, my workaround for this situation is this: simply open a scriptblock declaration, without closing it. This prevents PSReadLine from accepting a line as valid input, and it stays in edit mode.

Image

Then you can paste in whatever, and it stays in edit mode:

Image

Then either navigate to the beginning and remove the curlie, or close the scriptblock and then navigate to the beginning and insert an invocation operator.

@AltitudeApps commented on GitHub (Apr 26, 2025): You may have already thought of this, but for anyone else, my workaround for this situation is this: simply open a scriptblock declaration, without closing it. This prevents PSReadLine from accepting a line as valid input, and it stays in edit mode. ![Image](https://github.com/user-attachments/assets/98f3a3b1-45dc-4651-9a67-c553c13ef98d) Then you can paste in whatever, and it stays in edit mode: ![Image](https://github.com/user-attachments/assets/934fa680-2bc2-4c4d-be4f-46ae7e8b032d) Then either navigate to the beginning and remove the curlie, or close the scriptblock and then navigate to the beginning and insert an invocation operator.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#22295