[PR #6004] Add copyFormatting keybinding arg and array support #26569

Open
opened 2026-01-31 09:16:51 +00:00 by claunia · 0 comments
Owner

Original Pull Request: https://github.com/microsoft/terminal/pull/6004

State: closed
Merged: Yes


Summary of the Pull Request

Adds array support for the existing copyFormatting global setting. This allows users to define which formats they would specifically like to be copied. A boolean value is still accepted and is translated to the following:

  • false --> "none" or []
  • true --> "all" or ["html", "rtf"]

This also adds copyFormatting as a keybinding arg for copy. As with the global setting, a boolean value and array value is accepted.

References

#5212 - Spec for formatted copying
#2690 - disable html copy

PR Checklist

Detailed Description of the Pull Request / Additional comments

CopyFormat is a winrt enum where each accepted format is a flag. Currently accepted formats include html, and rtf. A boolean value is accepted and converted. true is a conjunction of all the formats. false only includes plain text.

For the global setting, null is not accepted. We already have a default value from before so no worries there.

For the keybinding arg, null (the default value) means that we just do what the global arg says to do. Overall, the copyFormatting keybinding arg is an override of the global setting when using that keybinding.

Validation Steps Performed

Validated behavior with every combination of values below:

  • copyFormatting global: { true, false, [], ["html"] }
  • copyFormatting copy arg: { null, true, false, [], [, "html"]}
**Original Pull Request:** https://github.com/microsoft/terminal/pull/6004 **State:** closed **Merged:** Yes --- ## Summary of the Pull Request Adds array support for the existing `copyFormatting` global setting. This allows users to define which formats they would specifically like to be copied. A boolean value is still accepted and is translated to the following: - `false` --> `"none"` or `[]` - `true` --> `"all"` or `["html", "rtf"]` This also adds `copyFormatting` as a keybinding arg for `copy`. As with the global setting, a boolean value and array value is accepted. ## References #5212 - Spec for formatted copying #2690 - disable html copy ## PR Checklist * [X] Closes #4191 * [X] Closes #5262 * [ ] Tests added/passed * [X] Requires documentation to be updated ## Detailed Description of the Pull Request / Additional comments CopyFormat is a winrt enum where each accepted format is a flag. Currently accepted formats include `html`, and `rtf`. A boolean value is accepted and converted. `true` is a conjunction of all the formats. `false` only includes plain text. For the global setting, `null` is not accepted. We already have a default value from before so no worries there. For the keybinding arg, `null` (the default value) means that we just do what the global arg says to do. Overall, the `copyFormatting` keybinding arg is an override of the global setting **when using that keybinding**. ## Validation Steps Performed Validated behavior with every combination of values below: - `copyFormatting` global: { `true`, `false`, `[]`, `["html"]` } - `copyFormatting` copy arg: { `null`, `true`, `false`, `[]`, `[, "html"]`}
claunia added the pull-request label 2026-01-31 09:16:51 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#26569