Skip to content
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

Merged
merged 14 commits into from
Apr 9, 2020
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 90 additions & 0 deletions doc/specs/#4191 - Formatted Copy/spec.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
---
author: Kayla Cinnamon @cinnamon-msft
created on: 2020-04-01
last updated: 2020-04-07
issue id: #4191
---

# Formatted Copy

## Abstract

When copying text, the Terminal should provide the option of including formatting. Not all apps that receive text allow for picking which format you want when pasting. The default should be to only copy plain text, based on the response from this poll on Twitter.

![Twitter poll](twitter-poll.png)

## Solution Proposals

A proposal for the right click behavior as well as two user settings proposals are described below:

1. [Right click behavior](#right-click-behavior)
2. [Settings option 1 - global setting](#settings-option-1---global-setting)
3. [Settings option 2 - key binding argument](#settings-option-2---key-binding-argument)
cinnamon-msft marked this conversation as resolved.
Show resolved Hide resolved

### Right click behavior

By default, right clicking to copy would only copy the plain text.

### Settings option 1 - global setting

We could have a global setting that when enabled, would copy formatting to the clipboard on all copy operations.

### Settings option 2 - key binding argument

We could add an argument to the `copy` key binding argument to allow for formatted copying when the user chooses to do so.

## UI/UX Design

### Settings option 1 - global setting

a. The user could list which kinds of formats they want included when they copy. When right clicking, they would copy with these formats.

`"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.

`"copyFormatting": true`

### Settings option 2 - key binding argument

a. Just like the `trimWhitespace` argument you can add to the `copy` key binding, we could add one for text formatting. This would not change the right click behavior.

`{"command": {"action": "copy", "keepFormatting": true}, "keys": "ctrl+a"}`

b. We could also split out the html and rtf formats. The right click behavior would still stay as default.

`{"command": {"action": "copy", "formats": ["html","rtf","plain"]}, "keys": "ctrl+a"}`

## Capabilities

### Accessibility

This shouldn't affect accessibility.

### Security

This does not affect security.

### Reliability

This does not affect reliability.

### Compatibility

This breaks the existing behavior of always copying the formatting. The justification for breaking this default behavior is in response to the community saying the default should be plain text only.

### Performance, Power, and Efficiency

## Potential Issues

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
Copy link
Member

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.

cinnamon-msft marked this conversation as resolved.
Show resolved Hide resolved

We could always add an additional option if people want more flexibility. For example, if we ship a global setting now, we could ship a key binding later that lets you choose how you want to copy, and vice versa.

## 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.
Copy link
Member

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)

Copy link
Member

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


## Resources
cinnamon-msft marked this conversation as resolved.
Show resolved Hide resolved
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.