Bracketed paste doesn't send wrapper escape codes #16658

Closed
opened 2026-01-31 05:18:45 +00:00 by claunia · 4 comments
Owner

Originally created by @schungx on GitHub (Feb 5, 2022).

Windows Terminal version

1.11.3471.0

Windows build number

10.0.22000.434

Other Software

No response

Steps to reproduce

  1. Send "\x1b[?2004h" to Windows Terminal to turn on bracketed paste mode.

  2. Copy sections of text with \n

  3. Paste into terminal

  4. Notice that the multi-line paste warning does NOT appear. This confirms bracketed paste mode.

  5. In app, read from stdin.

  6. Confirm that "\x1b[200~" does not precede the pasted text.

Expected Behavior

The pasted text should be wrapped with "\x1b[200~" and "\x1b[201~"

Actual Behavior

No wrapping escape sequences.

Originally created by @schungx on GitHub (Feb 5, 2022). ### Windows Terminal version 1.11.3471.0 ### Windows build number 10.0.22000.434 ### Other Software _No response_ ### Steps to reproduce 1) Send `"\x1b[?2004h"` to Windows Terminal to turn on bracketed paste mode. 2) Copy sections of text with `\n` 3) Paste into terminal 4) Notice that the multi-line paste warning does **NOT** appear. This confirms bracketed paste mode. 5) In app, read from `stdin`. 6) Confirm that `"\x1b[200~"` does not precede the pasted text. ### Expected Behavior The pasted text should be wrapped with `"\x1b[200~"` and `"\x1b[201~"` ### Actual Behavior No wrapping escape sequences.
claunia added the Needs-TriageNeeds-Tag-FixNeeds-Attention labels 2026-01-31 05:18:45 +00:00
Author
Owner

@DHowett commented on GitHub (Feb 6, 2022):

So, there's a bit of nuance here depending on what application is requesting bracketed paste mode.

For a Win32 application, you will only receive the bracketing sequences if you have the console mode ENABLE_VIRTUAL_TERMINAL_INPUT set. Without that mode, you are telling the console subsystem that you can't understand VT. . . so we don't send you any!

@DHowett commented on GitHub (Feb 6, 2022): So, there's a bit of nuance here depending on what application is requesting bracketed paste mode. For a Win32 application, you will only receive the bracketing sequences *if you have the console mode `ENABLE_VIRTUAL_TERMINAL_INPUT` set.* Without that mode, you are telling the console subsystem that you can't understand VT. . . so we don't send you any!
Author
Owner

@schungx commented on GitHub (Feb 6, 2022):

For a Win32 application, you will only receive the bracketing sequences if you have the console mode ENABLE_VIRTUAL_TERMINAL_INPUT set.

Ah. Makes sense. Let me figure out how to set that mode...

@schungx commented on GitHub (Feb 6, 2022): > For a Win32 application, you will only receive the bracketing sequences _if you have the console mode `ENABLE_VIRTUAL_TERMINAL_INPUT` set._ Ah. Makes sense. Let me figure out how to set that mode...
Author
Owner

@schungx commented on GitHub (Feb 6, 2022):

OK, turning on ENABLE_VIRTUAL_TERMINAL_INPUT makes it work. Thanks a lot!

This probably should be in the docs!

@schungx commented on GitHub (Feb 6, 2022): OK, turning on `ENABLE_VIRTUAL_TERMINAL_INPUT` makes it work. Thanks a lot! This probably should be in the docs!
Author
Owner

@DHowett commented on GitHub (Feb 6, 2022):

That's an excellent point. We haven't updated our documentation to encompass "enlightened terminals" since we started supporting them. I'll file this as a followup when I'm in the office!

@DHowett commented on GitHub (Feb 6, 2022): That's an excellent point. We haven't updated our documentation to encompass "enlightened terminals" since we started supporting them. I'll file this as a followup when I'm in the office!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#16658