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

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

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/6004
Author: @carlos-zamora
Created: 5/19/2020
Status: Merged
Merged: 8/15/2020
Merged by: @DHowett

Base: masterHead: dev/cazamor/copy-formatting-arg


📝 Commits (10+)

  • 0395d46 allow copyFormatting to be an array
  • 8a52b23 add copyFormatting as a copy arg
  • 0bb55eb add keybinding arg to copy
  • d86c1ea update docs and fix a few comments
  • 322da3b code format
  • f2bfeda change sentinel value to 0
  • bb27289 attempt to use JsonUtilsNew (and fail :( )
  • 0532d0d Merge branch 'master' into dev/cazamor/copy-formatting-arg
  • 0dc5b2a PR comments (2 errors from JsonUtilsNew and WI_...)
  • f1c93eb Merge branch 'master' into dev/cazamor/copy-formatting-arg

📊 Changes

14 files changed (+174 additions, -33 deletions)

View changed files

📝 doc/cascadia/SettingsSchema.md (+2 -2)
📝 doc/cascadia/profiles.schema.json (+40 -2)
📝 src/cascadia/TerminalApp/ActionArgs.cpp (+40 -2)
📝 src/cascadia/TerminalApp/ActionArgs.h (+5 -1)
📝 src/cascadia/TerminalApp/ActionArgs.idl (+1 -0)
📝 src/cascadia/TerminalApp/AppActionHandlers.cpp (+1 -1)
📝 src/cascadia/TerminalApp/GlobalAppSettings.h (+1 -1)
📝 src/cascadia/TerminalApp/JsonUtils.h (+1 -1)
📝 src/cascadia/TerminalApp/TerminalPage.cpp (+14 -3)
📝 src/cascadia/TerminalApp/TerminalPage.h (+1 -1)
📝 src/cascadia/TerminalApp/TerminalSettingsSerializationHelpers.h (+24 -0)
📝 src/cascadia/TerminalControl/TermControl.cpp (+22 -15)
📝 src/cascadia/TerminalControl/TermControl.h (+12 -3)
📝 src/cascadia/TerminalControl/TermControl.idl (+10 -1)

📄 Description

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"]}

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/microsoft/terminal/pull/6004 **Author:** [@carlos-zamora](https://github.com/carlos-zamora) **Created:** 5/19/2020 **Status:** ✅ Merged **Merged:** 8/15/2020 **Merged by:** [@DHowett](https://github.com/DHowett) **Base:** `master` ← **Head:** `dev/cazamor/copy-formatting-arg` --- ### 📝 Commits (10+) - [`0395d46`](https://github.com/microsoft/terminal/commit/0395d461507429c0424b81c3df442f09b1a54cf3) allow copyFormatting to be an array - [`8a52b23`](https://github.com/microsoft/terminal/commit/8a52b23104397cc73e77b4ff1af73e15ed80885a) add copyFormatting as a copy arg - [`0bb55eb`](https://github.com/microsoft/terminal/commit/0bb55eb4d03efc8a9a2e4d35c7d16028b77378e4) add keybinding arg to copy - [`d86c1ea`](https://github.com/microsoft/terminal/commit/d86c1eaa4394b73ce145f66fc60e72bda2c4b3f9) update docs and fix a few comments - [`322da3b`](https://github.com/microsoft/terminal/commit/322da3b7406bfcc1339f59fe520d626d5232a9e0) code format - [`f2bfeda`](https://github.com/microsoft/terminal/commit/f2bfeda6fbec67a15e3cc179af35e976c52dcd2e) change sentinel value to 0 - [`bb27289`](https://github.com/microsoft/terminal/commit/bb27289bd8e8e528a036103efdfd3a8e73f442a9) attempt to use JsonUtilsNew (and fail :( ) - [`0532d0d`](https://github.com/microsoft/terminal/commit/0532d0d9193677dbcccacf99e6c10654c0062132) Merge branch 'master' into dev/cazamor/copy-formatting-arg - [`0dc5b2a`](https://github.com/microsoft/terminal/commit/0dc5b2a40ab2c2a9e3652e008fe161ae32bb9444) PR comments (2 errors from JsonUtilsNew and WI_...) - [`f1c93eb`](https://github.com/microsoft/terminal/commit/f1c93ebd7d68a71ce06149e9ba2bc1107eac6a11) Merge branch 'master' into dev/cazamor/copy-formatting-arg ### 📊 Changes **14 files changed** (+174 additions, -33 deletions) <details> <summary>View changed files</summary> 📝 `doc/cascadia/SettingsSchema.md` (+2 -2) 📝 `doc/cascadia/profiles.schema.json` (+40 -2) 📝 `src/cascadia/TerminalApp/ActionArgs.cpp` (+40 -2) 📝 `src/cascadia/TerminalApp/ActionArgs.h` (+5 -1) 📝 `src/cascadia/TerminalApp/ActionArgs.idl` (+1 -0) 📝 `src/cascadia/TerminalApp/AppActionHandlers.cpp` (+1 -1) 📝 `src/cascadia/TerminalApp/GlobalAppSettings.h` (+1 -1) 📝 `src/cascadia/TerminalApp/JsonUtils.h` (+1 -1) 📝 `src/cascadia/TerminalApp/TerminalPage.cpp` (+14 -3) 📝 `src/cascadia/TerminalApp/TerminalPage.h` (+1 -1) 📝 `src/cascadia/TerminalApp/TerminalSettingsSerializationHelpers.h` (+24 -0) 📝 `src/cascadia/TerminalControl/TermControl.cpp` (+22 -15) 📝 `src/cascadia/TerminalControl/TermControl.h` (+12 -3) 📝 `src/cascadia/TerminalControl/TermControl.idl` (+10 -1) </details> ### 📄 Description ## 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"]`} --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-31 09:16:50 +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#26564