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

Copy & Paste Keybindings #968

Closed
CobusKruger opened this issue May 23, 2019 · 60 comments · Fixed by #1093
Closed

Copy & Paste Keybindings #968

CobusKruger opened this issue May 23, 2019 · 60 comments · Fixed by #1093
Labels
Area-User Interface Issues pertaining to the user interface of the Console or Terminal Help Wanted We encourage anyone to jump in on these. Issue-Task It's a feature request, but it doesn't really need a major design. Needs-Tag-Fix Doesn't match tag requirements Product-Terminal The new Windows Terminal.
Milestone

Comments

@CobusKruger
Copy link

CobusKruger commented May 23, 2019

Environment

Windows build number: 10.0.18362.86
Windows Terminal version (if applicable):

Steps to reproduce

In the standard Windows 10 console, you can enable the use of Ctrl+C/V for copy and paste. Windows Terminal doesn't have this, and it is extremely frustrating.

Expected behavior

Enable the use of Ctrl+C for copy and Ctrl+V for paste.

Actual behavior

Ctrl+C doesn't copy anything, and Ctrl+V just writes ^V at the prompt.

@ghost ghost added Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Needs-Tag-Fix Doesn't match tag requirements labels May 23, 2019
@zadjii-msft
Copy link
Member

This sounds right up @carlos-zamora's alley

@zadjii-msft zadjii-msft added Area-User Interface Issues pertaining to the user interface of the Console or Terminal Help Wanted We encourage anyone to jump in on these. Issue-Task It's a feature request, but it doesn't really need a major design. Product-Terminal The new Windows Terminal. labels May 23, 2019
@ghost ghost removed the Needs-Tag-Fix Doesn't match tag requirements label May 23, 2019
@zadjii-msft
Copy link
Member

Or actually, anyone could hop on this. You'd want to set up copy and paste actions in App.cpp (like _Scroll, for example) that trigger the appropriate actions on the TermControl. There should already be Copy and Paste ShortcutActions, so it's just a matter of registering defaults for them, and wiring the actions to the bindings (see HookupKeyBindings or similar in App.cpp).

@DHowett-MSFT
Copy link
Contributor

I must insist that the default bindings for this not be Ctrl+-only.

@DHowett-MSFT
Copy link
Contributor

DHowett-MSFT commented May 23, 2019

Agh, sorry. I didn't intend to close this issue.

@CobusKruger
Copy link
Author

I must insist that the default bindings for this not be Ctrl+-only.

I know why you're saying that, and that's of course why the normal console has it behind a setting one must enable. But having them behind Ctrl+Shift or something similar defeats the purpose. It's the muscle memory that make these the keybindings worth having.

For me, having Ctrl+V enter ^V has never been useful and I suspect that this is true for a very significant number of people. Would it be possible to enable this as a setting?

@DHowett-MSFT
Copy link
Contributor

Maybe we'll need profile-specific key bindings. Right now, all binds are re-bindable 😄

@namatoj
Copy link

namatoj commented May 25, 2019

I like the way that WSL+Bash handles copy/paste. Ctrl+C only copies when something is selected. If nothing is selected then Ctrl+C behaves as usual and sends an SIGINT.

@CobusKruger
Copy link
Author

@namatoj That's perfect; exactly the way it should be.

@DHowett-MSFT DHowett-MSFT removed the Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting label May 28, 2019
@driver1998
Copy link

I guess we should at least support Ctrl-Insert/Shift-Insert/Shift-Delete if Ctrl-C/V/X may have conflicts?

@mikepurvis
Copy link

IMO the options should be:

  • "Smart" behaviour, where CTRL-C is copy only if something is selected.
  • Custom behaviour, with keybindings that default to CTRL-SHIFT-C/V.
  • No behaviour, copy is available in the right-click menu on selection.

@DHowett-MSFT
Copy link
Contributor

DHowett-MSFT commented Jun 6, 2019

All of the discussion about "CTRL+C being copy only if something is selected" ignores CTRL+V -- there's no indicator to know that we should paste, and if one values consistency above all else it's problematic to say "CTRL+C only works when X, but CTRL+V works always". The alternative, "CTRL+C if selected, CTRL+SHIFT+V to paste always" isn't particularly consistent either.

@mikepurvis
Copy link

But CTRL-C is universally "send a SIGINT", there's a huge ambiguity there. Ubuntu's terminal resolves this by using CTRL-SHIFT-C/V for copy/paste; the MacOS terminal resolves it by using CMD-C for copy and CTRL-C for interrupt.

CTRL-V has no such conflict. Some emacs users might bind it to things, but if you're enough of an emacs power user to be rebinding keys, you're probably using capslock as your meta key anyway.

I think the main risk of making the "smart" behaviour the default is just that users will accidentally interrupt a process because they missed their selection. If that's a concern or we want consistency then I would say to just copy Ubuntu and make the default bindings for both CTRL-SHIFT-C/V.

@mdtauk
Copy link

mdtauk commented Jun 6, 2019

By implementing Customised Keybindings per profile, this could allow the default Ubuntu keyboard shortcuts to behave as they should, or allow the user to change them to allow Windows clipboard shortcuts to behave as they should.

@RobCannon
Copy link

@mikepurvis The smart Ctrl-C behavior is used in many Windows terminals with no issues. I like how https://github.com/Eugeny/terminus does it where it flashes a short pop-up to indicate text has been copied or pasted.

@mdtauk
Copy link

mdtauk commented Jun 8, 2019

@mikepurvis The smart Ctrl-C behavior is used in many Windows terminals with no issues. I like how https://github.com/Eugeny/terminus does it where it flashes a short pop-up to indicate text has been copied or pasted.

Tooltips for Copied would be good, especially where Ctrl+C is not always assigned to Copying

@bjorn-ali-goransson
Copy link

As we can see, this is a constantly occurring problem because it's unintuitive. See ayugioh2003/today-i-learned#281

Ctrl+C, Ctrl+V should "just work", and there is no way of going around that. The users have made (and keep on doing) their verdict.

And as the new command line tool (not this one) works "correctly", ie. as expected, this one should too. If you developers are fond of another scenario, please add it as a setting and let the popular behavior be the default.

@DHowett-MSFT DHowett-MSFT reopened this Mar 19, 2020
@ghost ghost removed the Needs-Tag-Fix Doesn't match tag requirements label Mar 19, 2020
@ghost ghost added the Needs-Tag-Fix Doesn't match tag requirements label Mar 19, 2020
@DHowett-MSFT
Copy link
Contributor

I appreciate your input here. Thanks! Just to underscore a couple of points:

  • It is a setting today! These key bindings can be set in profiles.json.
  • A preliminary look at the landscape of users who have customized their profiles shows that less than 1% of Terminal users are binding ctrl+c/v. It appears as though the popular behavior has been set as the default.

@bjorn-ali-goransson
Copy link

bjorn-ali-goransson commented Mar 19, 2020 via email

@TomasHubelbauer
Copy link

For anyone landing on this thread from Google: the default keybindings are Ctrl+Shift+C and Ctrl+Shift+V. I have not found these in my settings, so I wasn't sure what the default are.

Also, I don't see this discussed here, but I think it is worth mentioning: Enter to copy and right-click to paste does not work either.

Rican7 added a commit to Rican7/dotfiles that referenced this issue Mar 23, 2020
for my dual-bound paste to be separate records, rather than "chorded"

See:

 - microsoft/terminal#968 (comment)
 - microsoft/terminal#5015
@kvietmeier
Copy link

From an accessibility standpoint having combinations of 3 keys, or a mouse click+key is very difficult if not impossible for people with one hand or otherwise limited hand function. This is a big reason why I can't use emacs and stuck with vi/vim.

The default behavior that we have had in Linux/Xwindows for the last 20yrs is the most accessible. DoubleClick to select a word, tripleclick the line, and right click pastes. This appears to work within a Terminal frame but it doesn't reliably populate the clipboard. Note - ConEmu has this functionality - I can select text in a terminal and it populates the clipboard.

@yepthatsjason
Copy link

@DHowett-MSFT, I was also stuck not understanding why copy/paste doesn't work just like every other terminal on Windows or Linux (which is what lead me to this github issue after some searching). I don't think that people prefer this setting, they just have no clue how to change it and don't feel comfortable editing the keybindings file.

@mikepurvis
Copy link

doesn't work just like every other terminal on Windows or Linux

That's a little dramatic, given that the present default behaviour of Terminal (Ctrl-Shift-C/V) matches exactly what the default terminal on Ubuntu does.

@bjorn-ali-goransson
Copy link

bjorn-ali-goransson commented Apr 9, 2020 via email

@mikepurvis
Copy link

I'm just calling out that it's unfair to be clutching our pearls and claiming the Terminal team have made the wrong call here because it's different from "every other terminal on Windows or Linux", when every other terminal on Windows is a third party affair and the team here has copied as defaults what the leading Linux distribution has been doing since forever.

And the only reason this isn't an issue on Mac OS as well is that cmd and ctrl on that system happen to be separate buttons.

@bjorn-ali-goransson
Copy link

bjorn-ali-goransson commented Apr 9, 2020 via email

@jave27
Copy link

jave27 commented Apr 9, 2020

For telemetry's sake, I just downloaded and built this terminal today, and this is my only major complaint so far. There's an option in Preferences that indicates to me that Ctrl-C/V should work, but it quite obviously doesn't. Please enable the "Smart Ctrl-C" feature mentioned above, it's been my #1 complaint about CMD since the dawn of time. :)

@gakio12
Copy link

gakio12 commented Apr 10, 2020

I want to point out that I found this issue searching for how Windows Terminal implemented copy paste. One of the biggest complaints I hear from developers working on both Linux and Windows is that Windows copy/paste is inconsistent with whatever third party shell is installed and between Linux. Nearly every Linux distribution / terminal uses ctrl+shift+c/v, so I am glad that Windows Terminal also has that set as the default.

@bjorn-ali-goransson
Copy link

Why not have both Ctrl+C/V and Ctrl+Shift+C/V though?

@zadjii-msft
Copy link
Member

@bjorn-ali-goransson We actually just changed the default settings file to include both, so users can easily opt-out of Ctrl+C/Ctrl+V if they want.

See this PR and #5187

@soilstack
Copy link

  • It appears as though the popular behavior has been set as the default.

Nonsense. It means people abandon trying to fix it, or don't know that it can be fixed.

It's the reason I am on this thread at all now.

@DHowett-MSFT
Copy link
Contributor

@soilstack thanks. Consider reading the most recent messages on this thread.

@SteveIves
Copy link

It is truly astounding to me that you guys can't figure out how to make something as fundamental as this work! This is a huge deal. I love everything else about the Terminal app, but this basic flaw catches me out every time I use it.

@zadjii-msft
Copy link
Member

zadjii-msft commented Jun 9, 2020

@SteveIves You know you can change your keybindings to be whatever you'd like, right? If you want Ctrl+C/V as copy-paste, go ahead and add those to your keybindings. If you want Ctrl+Shift+C/V, you can use those too. If you want alt+q as copy and shift+0 as paste, go for it.

As of 1.0, the defaults include Ctrl+Shift+C/V as copy-paste, and new users will also get Ctrl+C/V as copy/paste in their settings file.

EDIT: use whatever subset of these you want:

{
  "keybindings": [
    // Ctrl+C / Ctrl+V for copy paste
    { "keys": "ctrl+c", "command": "copy"},
    { "keys": "ctrl+v", "command": "paste"},

    // Ctrl+Shift+C / Ctrl+Shift+V for copy paste
    { "keys": "ctrl+shift+c", "command": "copy"},
    { "keys": "ctrl+shift+v", "command": "paste"},


    // Disable Ctrl+Shift+C / Ctrl+Shift+V for copy paste
    { "keys": "ctrl+shift+c", "command": "unbound"},
    { "keys": "ctrl+shift+v", "command": "unbound"},
  ]
}

@SteveIves
Copy link

@zadjii-msft yes, I know this, and as a dev I can do this. But if you want Terminal to replace cmd.exe then you need to fix this.

@zadjii-msft
Copy link
Member

Out of curiosity, what part of

As of 1.0, the defaults include Ctrl+Shift+C/V as copy-paste, and new users will also get Ctrl+C/V as copy/paste in their settings file.

is us not fixing this?

@jagojar
Copy link

jagojar commented Jun 11, 2020

Ctrl+Shift+C/V is not natural. Also not right-click menu? I find Windows Terminal useful, but the lack of the menu and Ctrl+C/V is making me reconsider my options.

@DHowett
Copy link
Member

DHowett commented Jun 11, 2020

Yeah, this thread has run its course. Anybody who is inclined to comment: read the most recent four comments. It says all you need to know.

@microsoft microsoft locked as resolved and limited conversation to collaborators Jun 11, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Area-User Interface Issues pertaining to the user interface of the Console or Terminal Help Wanted We encourage anyone to jump in on these. Issue-Task It's a feature request, but it doesn't really need a major design. Needs-Tag-Fix Doesn't match tag requirements Product-Terminal The new Windows Terminal.
Projects
None yet
Development

Successfully merging a pull request may close this issue.