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 · 27 comments · Fixed by #1093

Comments

@CobusKruger
Copy link

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.

@zadjii-msft

This comment has been minimized.

Copy link
Member

commented May 23, 2019

This sounds right up @carlos-zamora's alley

@zadjii-msft

This comment has been minimized.

Copy link
Member

commented May 23, 2019

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

This comment has been minimized.

Copy link
Member

commented May 23, 2019

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

@DHowett-MSFT

This comment has been minimized.

Copy link
Member

commented May 23, 2019

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

@CobusKruger

This comment has been minimized.

Copy link
Author

commented May 23, 2019

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

This comment has been minimized.

Copy link
Member

commented May 23, 2019

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

@namatoj

This comment has been minimized.

Copy link

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

This comment has been minimized.

Copy link
Author

commented May 25, 2019

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

@driver1998

This comment has been minimized.

Copy link

commented May 30, 2019

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

@mikepurvis

This comment has been minimized.

Copy link

commented Jun 6, 2019

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

This comment has been minimized.

Copy link
Member

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

This comment has been minimized.

Copy link

commented Jun 6, 2019

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

This comment has been minimized.

Copy link

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

This comment has been minimized.

Copy link

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.

@mdtauk

This comment has been minimized.

Copy link

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

@NatoBoram

This comment has been minimized.

Copy link

commented Jun 22, 2019

Gnome Terminal have a consistent keybinding that's not intuitive at first, but easy to adopt, and not too far from the usual CTRL + C for copy.

CTRL + C : Cancel
CTRL + Shift + C : Copy
CTRL + Shift + V : Paste

No logic for selection, always works a specific way. I think it's perfect. It would also harmonize with other OSes, since this behaviour is consistent across Linux and MacOS.

Really, I don't think we have any excuses since Command Prompt uses Enter for copy and Right Click for paste.

@RobCannon

This comment has been minimized.

Copy link

commented Jun 22, 2019

@NatoBoram That is fine as an option. But many people like the smart behavior. Everywhere else in Windows, Ctrl+C is copy and it is hard to adjust the behavior for one app, so I want the smart behavior.

@MythreyaK

This comment has been minimized.

Copy link

commented Jun 22, 2019

Also, since the Conhost also lives here; the effects of pasting text obtained with Ctrl+C and Ctrl+Shift+C has different effects.

image

The way the buffer is read is correct for the Ctrl+C a.k.a the smart behavior shortcut (i.e., with the line endings).

All terminal-like apps have this issue (CMD, Powershell, WLS-apps) and since the brains behind all of them lives here, thought I'd post it.

@NatoBoram

This comment has been minimized.

Copy link

commented Jun 26, 2019

Everywhere else in Windows, Ctrl + C is copy

And in Linux and in MacOS. Windows isn't any different in that regard.

It is hard to adjust the behavior for one app

Yes, which is why Microsoft decided that it would be a great idea to use Enter for copy and Right Click for paste.
*Ahem*
I mean, it is hard to adjust the behavior for one Operating System. 🧂

@codefoster

This comment has been minimized.

Copy link

commented Jul 11, 2019

Throwing in another vote (even though the issue is closed) for an option of configuring the smart behavior. I for one would configure smart behavior for copy and CTRL+v for paste always. If I have text highlighted and I want to send a SIGINT I expect to hit ESC and then CTRL+c.

@conan

This comment has been minimized.

Copy link

commented Jul 26, 2019

Same here, I'd love an option to make ctrl+v paste always, and ctrl+c to copy when selected and SIGINT when no selection exists. This is the behaviour I currently have in conemu.

@msftbot

This comment has been minimized.

Copy link

commented Aug 3, 2019

🎉This issue was addressed in #1093, which has now been successfully released as Windows Terminal Preview v0.3.2142.0.🎉

Handy links:

@kennethz3

This comment has been minimized.

Copy link

commented Aug 6, 2019

🎉This issue was addressed in #1093, which has now been successfully released as Windows Terminal Preview v0.3.2142.0.🎉

Handy links:

* [Release Notes](https://github.com/microsoft/terminal/releases/tag/v0.3.2142.0)

* [Store Download](https://www.microsoft.com/store/apps/9n0dx20hk701?cid=storebadge&ocid=badge)

Adding these key bindings does the trick

{
                "command" : "copy",
                "keys" : 
                [
                    "ctrl+shift+c"
                ]
},
{
                "command" : "paste",
                "keys" : [
                    "ctrl+shift+v"
                ]
}
@krlinus

This comment has been minimized.

Copy link

commented Aug 7, 2019

How come nobody thought about doing this the putty way? Currently the entire user base is using putty or cygwin. Select to copy, right click to paste. Nothing easier. Please, serve your users!

@DHowett-MSFT

This comment has been minimized.

Copy link
Member

commented Aug 7, 2019

nobody thought about

You mean #524 and #2152 (which is a pull request by one of the team members?)

@MythreyaK

This comment has been minimized.

Copy link

commented Aug 7, 2019

On a small side note, why does pasting text copied over with Ctrl+C and Ctrl+Shift+C seem to have different effects in powershell (described above in one of the comments, repeated here, 🙈 sorry!)?

@villeval

This comment has been minimized.

Copy link

commented Aug 14, 2019

Personally I prefer "dumb" copy-behavior i.e. separate binding for it instead of binding ctrl+c (usually SIGINT) to copy, when something is selected and messing with default behavior of many shells. This has potential to become annoying when you accidentally shutdown the application, which is running on foreground, when you're trying to only copy something. The current implementation is great!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
You can’t perform that action at this time.