Skip to content

Indicate support for OSC 52 in the DA1 report #19034

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 19, 2025

Conversation

j4james
Copy link
Collaborator

@j4james j4james commented Jun 14, 2025

Summary of the Pull Request

Some applications that make use of the OSC 52 clipboard sequence will
only do so if they can be certain that the terminal actually has that
functionality. Indicating our support for OSC 52 in the DA1 report
will give them an easy way to detect that.

References and Relevant Issues

OSC 52 support was added to Windows Terminal in issue #5823, and to
ConHost in issue #18949.

Detailed Description of the Pull Request / Additional comments

Support for writing to the clipboard is indicated in the primary device
attributes report by the extension parameter 52. This is obviously not
a standard DEC extension, but it's one that's been agreed upon by a
number of modern terminals. The extension is only reported when writing
to the clipboard is actually permitted (Windows Terminal has an option
to disable that).

Validation Steps Performed

I've updated the Device Attributes unit test to check that we're
reporting extension 52 when clipboard access is enabled, and not
reporting it when disabled.

PR Checklist

@lhecker
Copy link
Member

lhecker commented Jun 16, 2025

Thank you for reaching out to all the other terminals/applications as well! I've read through some of them, and one in particular was quite bemusing. 😄

Copy link
Member

@carlos-zamora carlos-zamora left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for doing this! 😊

@carlos-zamora carlos-zamora enabled auto-merge (squash) June 18, 2025 23:03
@DHowett
Copy link
Member

DHowett commented Jun 19, 2025

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Member

@DHowett DHowett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rad, I love the optional features enum

@carlos-zamora carlos-zamora merged commit 00ee884 into microsoft:main Jun 19, 2025
12 of 14 checks passed
craigbarnes added a commit to craigbarnes/dte that referenced this pull request Jun 23, 2025
Indicating support for `OSC 52` like this is quite a recent initiative,
but terminal-side support has already been merged in foot, WezTerm,
Contour and Windows Terminal. To me, it seems like a much more sensible
interface than the existing `XTGETTCAP` and `XTQALLOWED` methods
(although dte does already support the former).

See also:

* contour-terminal/contour#1761 (comment)
* https://github.com/contour-terminal/vt-extensions/blob/master/clipboard-extension.md#feature-detection
* https://codeberg.org/dnkl/foot/pulls/2130
* https://github.com/wezterm/wezterm/pull/7046/files
* microsoft/terminal#19034
* tmux/tmux#4532
* tmux/tmux#4539

Additional context for why I consider `XTGETTCAP` flawed:

* https://codeberg.org/dnkl/foot/issues/1701
* ghostty-org/ghostty#1699
DHowett pushed a commit that referenced this pull request Jun 24, 2025
Some applications that make use of the `OSC 52` clipboard sequence will
only do so if they can be certain that the terminal actually has that
functionality. Indicating our support for `OSC 52` in the `DA1` report
will give them an easy way to detect that.

`OSC 52` support was added to Windows Terminal in issue #5823, and to
ConHost in issue #18949.

Support for writing to the clipboard is indicated in the primary device
attributes report by the extension parameter `52`. This is obviously not
a standard DEC extension, but it's one that's been agreed upon by a
number of modern terminals. The extension is only reported when writing
to the clipboard is actually permitted (Windows Terminal has an option
to disable that).

I've updated the Device Attributes unit test to check that we're
reporting extension `52` when clipboard access is enabled, and not
reporting it when disabled.

- [x] Closes #19017
- [x] Tests added/passed

(cherry picked from commit 00ee884)
Service-Card-Id: PVTI_lADOAF3p4s4AmhmQzgbpe4k
Service-Version: 1.22
DHowett pushed a commit that referenced this pull request Jun 24, 2025
## Summary of the Pull Request
Some applications that make use of the `OSC 52` clipboard sequence will
only do so if they can be certain that the terminal actually has that
functionality. Indicating our support for `OSC 52` in the `DA1` report
will give them an easy way to detect that.

## References and Relevant Issues
`OSC 52` support was added to Windows Terminal in issue #5823, and to
ConHost in issue #18949.

## Detailed Description of the Pull Request / Additional comments
Support for writing to the clipboard is indicated in the primary device
attributes report by the extension parameter `52`. This is obviously not
a standard DEC extension, but it's one that's been agreed upon by a
number of modern terminals. The extension is only reported when writing
to the clipboard is actually permitted (Windows Terminal has an option
to disable that).

## Validation Steps Performed
I've updated the Device Attributes unit test to check that we're
reporting extension `52` when clipboard access is enabled, and not
reporting it when disabled.

## PR Checklist
- [x] Closes #19017
- [x] Tests added/passed

(cherry picked from commit 00ee884)
Service-Card-Id: PVTI_lADOAF3p4s4Axadtzgbpe4g
Service-Version: 1.23
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.

Indicate support for OSC 52 in the devices attributes report
4 participants