-
Notifications
You must be signed in to change notification settings - Fork 8.4k
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
doc: add a spec for the change to formatted copying #5212
Conversation
|
||
One possible issue is that discovering how to copy the formatting might be difficult to find. We could mitigate this by adding it into the settings.json file and commenting it out. | ||
|
||
## Future considerations |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#1553 - We should just treat Alt
like we do with Shift
in VTMM. It's a non-rebindable keybinding until then.
a. Just like the the `trimWhitespace` argument you can add to the `copy` key binding, we could add one for text formatting. | ||
|
||
`{"command": {"action": "copy", "keepFormatting": true}, "keys": "ctrl+a"}` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Personally, like this idea the best. It's simple and straightforward. At some point, after deciding which route to go with, we should decide what the default keybinding will be, if any.
I have a strong distaste for changing our default because of a handful of applications that lack "paste plain text" as an option. It's not a hill I'm willing to die on, but look:
|
That seems fair. So then the keybinding arg would default to "true" or "rtf, html, plain"? (this should be in the spec) |
(also maybe worth adding to the spec)
|
My bad. I didn't realize I approved this spec until just now.
Co-Authored-By: Carlos Zamora <[email protected]>
…t/terminal into cinnamon/html-copy-spec
I am strongly of the opinion that our default should be plain text copy. The votes were overwhelming towards plain text and other terminal emulators behave in this way (including conhost). We cannot guarantee that the receiving application will give you the ability to format your pasted text (Microsoft Teams for example). To address your concern about discoverability, if it's a global setting, it would be easy to find in a settings UI. We could also ship either the key binding or the global setting inside settings.json. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay so I've got some thoughts off the cuff:
- I think I prefer option 2, the keybinding arg one. That way users could specify different bindings for different formats.
- maybe if we had a global setting, then that would apply to all
copy
actions, unless they setformat
manually. So you could use["html", "rtf", "plain"]
globally for allcopy
actions, but then a particular keybinding only has["plain"]
. This is more of a 1&2 combo solution.
- maybe if we had a global setting, then that would apply to all
- I don't love the magic alt logic on right-click. Especially if we go with the global setting route. This would make more sense once we had mouse bindings, but I'm not so sure about it nowadays.
- We could always support
true == ["html", "rtf", "plain"]
, so the user could specify both? though the naming might be confusing then - I'd really love if we could have the "default" in
userDefaults.json
(the one that's created for new settings files) that includes all of["html", "rtf", "plain"]
by default, with a note that the user can remove whatever formats they want. That way, it's immensly more discoverable that those are options, and that they're trivial to opt out of.- The whole "copy as formatted text" thing was something that I wouldn't have thought I wanted until I had it and now I love it. If it's not immediately obvious as an option, I wouldn't have even looked for it.
- This sure sounds like a lot of work, more than a bugfix. Are we planning on getting this in on this side of 1.0?
I really like this. So then the following two keybindings would be deserialized to be the same thing:
and
Also agree (this should go in the spec) |
Co-Authored-By: Josh Soref <[email protected]>
Co-Authored-By: Josh Soref <[email protected]>
Co-Authored-By: Josh Soref <[email protected]>
|
||
`"copyFormats": ["html","rtf","plain"]` | ||
|
||
b. We could also just combine html and rtf into a single boolean. Users would either get plain text only (`false`) or all formatting (`true`) onto their clipboard. If this is set to `true`, the default right click behavior is reversed: right clicking copies the formatting and holding `alt` copies only the plain text. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
like other specs before it, make sure to call out the option we finally decided upon and move all unchosen options into an investigation notes section.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A spec isn't useful if it just says "we could do a, b, c" without it coming to its own consensus.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I followed the same formatting as the default profile settings spec and added a conclusions section at the bottom.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it might be clearer to make sure to mention "here are some proposals, with conclusions at the bottom" then, because I too got confused
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a couple of clarifications!
|
||
`"copyFormats": ["html","rtf","plain"]` | ||
|
||
b. We could also just combine html and rtf into a single boolean. Users would either get plain text only (`false`) or all formatting (`true`) onto their clipboard. If this is set to `true`, the default right click behavior is reversed: right clicking copies the formatting and holding `alt` copies only the plain text. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct me if I'm wrong, but if option b is the one we're going for, we're not having the Alt-RightClick
to copy plaintext/formatting right? Right click should just copy formatting if the setting is true, and plain text if false.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah nice catch. I just removed references to alt
right click functionality. 👍
Co-Authored-By: Leon Liang <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea these are kind of nits, so I'm not gonna block
|
||
`"copyFormats": ["html","rtf","plain"]` | ||
|
||
b. We could also just combine html and rtf into a single boolean. Users would either get plain text only (`false`) or all formatting (`true`) onto their clipboard. If this is set to `true`, the default right click behavior is reversed: right clicking copies the formatting and holding `alt` copies only the plain text. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it might be clearer to make sure to mention "here are some proposals, with conclusions at the bottom" then, because I too got confused
|
||
## Conclusions | ||
|
||
The team has decided to have plain text as the default copy behavior and to enable formatted copying with a global setting that accepts a boolean value (settings option 1 - global setting, option b). In the future, we can modify this setting to also accept an array, so the user can specify which formats they would like to copy. Additionally, a key binding can be added to allow for greater flexibility. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wait didn't we decide on a combo of both 2 & 3?
We do the global setting now, as a boolean, because that's easy. (This is 2a)
We can then update that to additionally accept an array in the future, where true
== [html, rtf, plain]
and false
==[plain]
(This is 2b)
Then, we could further add an optional parameter to the copy ShortcutAction
. If it's set, we'll copy with the provided formatting. Otherwise, we'll use the value of the global setting? (This is 3)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay I guess this is kinda what it does say, I just didn't immediately parse that this was a phased implementation plan
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lookin gud
## Summary of the Pull Request Implements `copyFormatting` as a global setting. When enabled, formatting such as font and foreground/background colors are copied to the clipboard on _all_ copy operations. Also updates the schema and docs. ## References #5212 - Spec for Formatted Copying #4191 - Setting to enable/disable formatted copy This feature will also have an impact on these yet-to-be-implemented features: - #5262 - copyFormatting Keybinding Arg for Copy - #1553 - Pointer Bindings ## PR Checklist * [X] Closes #4191 ## Detailed Description of the Pull Request / Additional comments We already check if the hstring passed into the clipboard is empty before setting it. So the majority of the changes are actually just adding the global setting in. ## Validation Steps Performed | `copyFormatting` | Mouse Copy | Keyboard Copy | |--|--|--| | not set (`false`) | ✔ | ✔ | | `true` | ✔ | ✔ | | `false` | ✔ | ✔ |
I addressed @zadjii-msft's nits as well as added @carlos-zamora's comment to the Future Considerations section. :) |
The main thing holding me back is still that the GitHub issues aren't linked. That makes things like this easier to track. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks
## Summary of the Pull Request Implements `copyFormatting` as a global setting. When enabled, formatting such as font and foreground/background colors are copied to the clipboard on _all_ copy operations. Also updates the schema and docs. ## References #5212 - Spec for Formatted Copying #4191 - Setting to enable/disable formatted copy #5263 - PR prematurely merged without approval of #5212 This feature will also have an impact on these yet-to-be-implemented features: - #5262 - copyFormatting Keybinding Arg for Copy - #1553 - Pointer Bindings - #4191 - add array support for `copyFormatting` ## Detailed Description of the Pull Request We already check if the hstring passed into the clipboard is empty before setting it. So the majority of the changes are actually just adding the global setting in. ## Validation Steps Performed | `copyFormatting` | Mouse Copy | Keyboard Copy | |--|--|--| | not set (`false`) | ✔ | ✔ | | `true` | ✔ | ✔ | | `false` | ✔ | ✔ |
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. 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**. References #5212 - Spec for formatted copying References #2690 - disable html copy Validated behavior with every combination of values below: - `copyFormatting` global: { `true`, `false`, `[]`, `["html"]` } - `copyFormatting` copy arg: { `null`, `true`, `false`, `[]`, `[, "html"]`} Closes #4191 Closes #5262
Summary of the Pull Request
This is the spec that goes into what we do with HTML copy once we set the default copy behavior to plain text.
References
#4191
PR Checklist
Detailed Description of the Pull Request / Additional comments
Validation Steps Performed