Unable to paste ASCII escape character (ASCII #001B) #13857

Closed
opened 2026-01-31 03:54:03 +00:00 by claunia · 7 comments
Owner

Originally created by @htravis123 on GitHub (May 20, 2021).

Windows Terminal version (or Windows build number)

1.7.1033.0

Other Software

No response

Steps to reproduce

  1. Enter an SSH session to a Linux system.
  2. Copy and attempt to paste ASCII/Unicode character 0x001B, then CTRL+[.

Expected Behavior

The character ^[ should appear.

Actual Behavior

No character appears.

Originally created by @htravis123 on GitHub (May 20, 2021). ### Windows Terminal version (or Windows build number) 1.7.1033.0 ### Other Software _No response_ ### Steps to reproduce 1. Enter an SSH session to a Linux system. 2. Copy and attempt to paste ASCII/Unicode character 0x001B, then `CTRL+[`. ### Expected Behavior The character `^[` should appear. ### Actual Behavior No character appears.
claunia added the Needs-TriageNeeds-Tag-FixNeeds-Attention labels 2026-01-31 03:54:04 +00:00
Author
Owner

@DHowett commented on GitHub (May 20, 2021):

This is by design as of #9034 -- we filter out control chars in pasted text so that rogue clipboard contents cannot break out of bracketed paste mode¹ or emit control sequences into the input stream.

What's your particular use case? We have a bindable sendInput action for sending raw data to the connected application that might be more suitable 😄, and if you're using an application that supports verbatim input (^V ^[) that may be an acceptable compromise.

¹ a safety and usability feature that allows an application to figure out when content came from the clipboard versus the keyboard

@DHowett commented on GitHub (May 20, 2021): This is by design as of #9034 -- we filter out control chars in pasted text so that rogue clipboard contents cannot break out of bracketed paste mode¹ or emit control sequences into the input stream. What's your particular use case? We have a bindable `sendInput` action for sending raw data to the connected application that might be more suitable :smile:, and if you're using an application that supports verbatim input (<kbd>^V ^[</kbd>) that may be an acceptable compromise. ¹ a safety and usability feature that allows an application to figure out when content came from the clipboard versus the keyboard
Author
Owner
@DHowett commented on GitHub (May 20, 2021): [Here's the specific discussion about whether to filter always, or only when bracketing](https://github.com/microsoft/terminal/pull/9034#discussion_r571844024)!
Author
Owner

@htravis123 commented on GitHub (May 20, 2021):

I just tried to set a sendInput action for ESC+[, but it isn't working. Not sure if I am doing something wrong, though.

@htravis123 commented on GitHub (May 20, 2021): I just tried to set a sendInput action for ESC+[, but it isn't working. Not sure if I am doing something wrong, though.
Author
Owner

@DHowett commented on GitHub (May 20, 2021):

Try this one-

{ "command": { "action": "sendInput", "input": "\u001b[" }, "keys": "whatever+you+want+for+keys" },
@DHowett commented on GitHub (May 20, 2021): Try this one- ``` { "command": { "action": "sendInput", "input": "\u001b[" }, "keys": "whatever+you+want+for+keys" }, ```
Author
Owner

@htravis123 commented on GitHub (May 20, 2021):

Actually, I didn't need the sendInput thingy, as I was already able to send ^[. but bash isn't accepting it as input.

@htravis123 commented on GitHub (May 20, 2021): Actually, I didn't need the sendInput thingy, as I was already able to send ^[. but bash isn't accepting it as input.
Author
Owner

@DHowett commented on GitHub (May 20, 2021):

I don't think it's supposed to, unless you use verbatim input with ^V (you may need to unbind "paste" from ctrl+v to do that). Otherwise, it's going to expect a control sequence to follow the escape.

Verbatim input tells the connected application, if it implements it, that "the next character should be taken literally- do not attempt to parse it".

Here, I used ctrl+v, ctrl+[ to enter ^[ as a single character-

image

@DHowett commented on GitHub (May 20, 2021): I don't think it's supposed to, unless you use verbatim input with <kbd>^V</kbd> (you may need to unbind "paste" from `ctrl+v` to do that). Otherwise, it's going to expect a control sequence to follow the escape. Verbatim input tells the connected application, if it implements it, that "the next character should be taken literally- do not attempt to parse it". Here, I used <kbd>ctrl+v, ctrl+[</kbd> to enter `^[` as a single character- ![image](https://user-images.githubusercontent.com/189190/119026812-3498cb00-b96b-11eb-9da7-85640baea58a.png)
Author
Owner

@htravis123 commented on GitHub (May 20, 2021):

I don't think it's supposed to, unless you use verbatim input with ^V (you may need to unbind "paste" from ctrl+v to do that). Otherwise, it's going to expect a control sequence to follow the escape.

Verbatim input tells the connected application, if it implements it, that "the next character should be taken literally- do not attempt to parse it".

Here, I used ctrl+v, ctrl+[ to enter ^[ as a single character-

image

CTRL+V worked! Everything's in order. Closing issue.

@htravis123 commented on GitHub (May 20, 2021): > > > I don't think it's supposed to, unless you use verbatim input with ^V (you may need to unbind "paste" from `ctrl+v` to do that). Otherwise, it's going to expect a control sequence to follow the escape. > > Verbatim input tells the connected application, if it implements it, that "the next character should be taken literally- do not attempt to parse it". > > Here, I used ctrl+v, ctrl+[ to enter `^[` as a single character- > > ![image](https://user-images.githubusercontent.com/189190/119026812-3498cb00-b96b-11eb-9da7-85640baea58a.png) CTRL+V worked! Everything's in order. Closing issue.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#13857