Terminal doesn't copy on Enter (like conhost does) #6783

Closed
opened 2026-01-31 00:47:10 +00:00 by claunia · 13 comments
Owner

Originally created by @ghost on GitHub (Mar 8, 2020).

Description of the Bug:
When we work on Command Prompt or PowerShell without using Windows Terminal, we have the option of copying text by selecting it and pressing Enter key. Later, we can paste the text whenever required by right-clicking anywhere inside the window. But Windows Terminal does not allow us to work in a similar manner. When we select any text inside Windows Terminal and press Enter key to copy it, it simply jumps to a new command (carriage return) without actually saving the text to the clipboard.

This issue may seem similar to #4835, #4149, #2340 and #4621. All those issues focus that the shortcuts Ctrl+C or Ctrl+V are not working. These issues can be fixed by adjusting the keybindings, but the current issue has not been fixed as per my knowledge.

Steps to Reproduce:

  1. Press [Win]+R, type ‘powershell.exe’ and hit Enter.
  2. Type in the following commands:
Import-Module PackageManagement
Get-Command -Module PackageManagement
  1. Select any command, for example ‘Install-Package’ using the mouse.
  2. Press enter to copy it.
  3. Then right-click anywhere inside the window. You will see the command pasted.
  4. Press [Win]+V to check the clipboard history. You will see the latest entry as ‘Install-Package’. Delete that entry.
  5. Now repeat the same steps by running PowerShell inside Windows Terminal. Notice the difference. Don’t forget to check the clipboard history again.

Expected Behaviour:
The Terminal should have copied the text on pressing Enter. The copied text should have been visible inside Clipboard History. It should not jump to a new command (carriage return).

Screenshots:

  1. For ‘powershell.exe’

image
image

  1. For Powershell inside Windows Terminal

image
image

Device and Application Information:
• OS Build: 10.0.18362.657
• Architecture: x64
• Application Version: 0.9.433.0
• Region: New Delhi, India
• Dev Version Installed: False

I’m just reporting the problem. I don’t want to fix it.

Originally created by @ghost on GitHub (Mar 8, 2020). **Description of the Bug**: When we work on Command Prompt or PowerShell without using Windows Terminal, we have the option of copying text by selecting it and pressing Enter key. Later, we can paste the text whenever required by right-clicking anywhere inside the window. But Windows Terminal does not allow us to work in a similar manner. When we select any text inside Windows Terminal and press Enter key to copy it, it simply jumps to a new command (carriage return) without actually saving the text to the clipboard. This issue may seem similar to #4835, #4149, #2340 and #4621. All those issues focus that the shortcuts Ctrl+C or Ctrl+V are not working. These issues can be fixed by adjusting the keybindings, but the current issue has not been fixed as per my knowledge. **Steps to Reproduce**: 1. Press [Win]+R, type ‘powershell.exe’ and hit Enter. 2. Type in the following commands: ``` Import-Module PackageManagement Get-Command -Module PackageManagement ``` 3. Select any command, for example ‘Install-Package’ using the mouse. 4. Press enter to copy it. 5. Then right-click anywhere inside the window. You will see the command pasted. 6. Press [Win]+V to check the clipboard history. You will see the latest entry as ‘Install-Package’. Delete that entry. 7. Now repeat the same steps by running PowerShell inside Windows Terminal. Notice the difference. Don’t forget to check the clipboard history again. **Expected Behaviour**: The Terminal should have copied the text on pressing Enter. The copied text should have been visible inside Clipboard History. It should not jump to a new command (carriage return). **Screenshots**: 1. For ‘powershell.exe’ ![image](https://user-images.githubusercontent.com/55381546/76166963-f27dd200-6188-11ea-888f-954869caf17b.png) ![image](https://user-images.githubusercontent.com/55381546/76166973-04f80b80-6189-11ea-9fa9-645fb7e2db37.png) 2. For Powershell inside Windows Terminal ![image](https://user-images.githubusercontent.com/55381546/76166982-14775480-6189-11ea-9a1f-671bf160a275.png) ![image](https://user-images.githubusercontent.com/55381546/76166984-20fbad00-6189-11ea-8221-2716c0df2029.png) **Device and Application Information**: • OS Build: 10.0.18362.657 • Architecture: x64 • Application Version: 0.9.433.0 • Region: New Delhi, India • Dev Version Installed: False I’m just reporting the problem. I don’t want to fix it.
claunia added the Resolution-By-DesignArea-SettingsNeeds-Tag-FixProduct-Terminal labels 2026-01-31 00:47:10 +00:00
Author
Owner

@j4james commented on GitHub (Mar 8, 2020):

Using the Enter key to copy was brought up in issue #715.

@j4james commented on GitHub (Mar 8, 2020): Using the `Enter` key to copy was brought up in issue #715.
Author
Owner

@zadjii-msft commented on GitHub (Mar 9, 2020):

Thanks for the suggestion! You're right that this is something that the Terminal doesn't do currently that conhost (the vintage console) does. You could actually probably get the Terminal to behave the same as conhost by adding the following to your keybindings:

{ "command": "copy", "keys": ["enter"] },

This will make enter work to copy the selection only when there's a selection.

There's a good chance that we're going to close this as a duplicate of #3058 - we might decide to ad this by default in the near future.

@zadjii-msft commented on GitHub (Mar 9, 2020): Thanks for the suggestion! You're right that this is something that the Terminal doesn't do currently that conhost (the vintage console) does. You could actually probably get the Terminal to behave the same as conhost by adding the following to your keybindings: ```json { "command": "copy", "keys": ["enter"] }, ``` This will make <kbd>enter</kbd> work to copy the selection _only when there's a selection_. There's a good chance that we're going to close this as a duplicate of #3058 - we might decide to ad this by default in the near future.
Author
Owner

@ghost commented on GitHub (Mar 9, 2020):

Yes, you are right. But what about using 'right click' to paste the copied item? How will that be handled?

@ghost commented on GitHub (Mar 9, 2020): Yes, you are right. But what about using 'right click' to paste the copied item? How will that be handled?
Author
Owner

@ghost commented on GitHub (Mar 9, 2020):

We might also need to implement the same context menu that we get on right-clicking the title bar of conhost.exe so that Windows Terminal behaves in a similar manner. That menu includes options like 'Mark', 'Copy', 'Paste' etc. The ability to mark text and copy it by pressing 'Enter' is what I wanted to say.

@ghost commented on GitHub (Mar 9, 2020): We might also need to implement the same context menu that we get on right-clicking the title bar of conhost.exe so that Windows Terminal behaves in a similar manner. That menu includes options like 'Mark', 'Copy', 'Paste' etc. The ability to mark text and copy it by pressing 'Enter' is what I wanted to say.
Author
Owner

@zadjii-msft commented on GitHub (Mar 9, 2020):

Right click to paste already works in the Terminal 😉

And "Mark Mode" is something that's already tracked in #715/#2840/#3758

@zadjii-msft commented on GitHub (Mar 9, 2020): Right click to paste already works in the Terminal 😉 And "Mark Mode" is something that's already tracked in #715/#2840/#3758
Author
Owner

@ghost commented on GitHub (Mar 9, 2020):

@zadjii-msft Thank you for making me aware. But my second last comment remains unanswered. Both of these features have to be implemented at the same time.

@ghost commented on GitHub (Mar 9, 2020): @zadjii-msft Thank you for making me aware. But my second last comment remains unanswered. Both of these features have to be implemented at the same time.
Author
Owner

@zadjii-msft commented on GitHub (Mar 9, 2020):

I'm certain there's a dupe for implementing this menu in the Terminal somewhere on this repo, but I'm having a really hard time finding it:

image

@zadjii-msft commented on GitHub (Mar 9, 2020): I'm _certain_ there's a dupe for implementing this menu in the Terminal _somewhere_ on this repo, but I'm having a really hard time finding it: ![image](https://user-images.githubusercontent.com/18356694/76252730-518a2800-6217-11ea-9d81-5ffd0d469dd5.png)
Author
Owner

@ghost commented on GitHub (Mar 10, 2020):

This may help you in that case. But I think you misunderstood my message. I was referring to the following comment:

Yes, you are right. But what about using 'right click' to paste the copied item? How will that be handled?
@ghost commented on GitHub (Mar 10, 2020): [This](https://github.com/microsoft/terminal/search?q=Mark+Copy+Paste&unscoped_q=Mark+Copy+Paste) may help you in that case. But I think you misunderstood my message. I was referring to the following comment: ```` Yes, you are right. But what about using 'right click' to paste the copied item? How will that be handled? ````
Author
Owner

@zadjii-msft commented on GitHub (Mar 10, 2020):

Yes, you are right. But what about using 'right click' to paste the copied item? How will that be handled?

I'm pretty sure I already answered that with

Right click to paste already works in the Terminal 😉

It's handled right here:
bf48ce5b51/src/cascadia/TerminalControl/TermControl.cpp (L897-L908)

Does right-click to paste not work for you currently?

@zadjii-msft commented on GitHub (Mar 10, 2020): > Yes, you are right. But what about using 'right click' to paste the copied item? How will that be handled? I'm pretty sure I already answered that with > Right click to paste already works in the Terminal 😉 It's handled right here: https://github.com/microsoft/terminal/blob/bf48ce5b51edd1822badc3310d3ac605b5ca9129/src/cascadia/TerminalControl/TermControl.cpp#L897-L908 Does right-click to paste _not_ work for you currently?
Author
Owner

@ghost commented on GitHub (Mar 10, 2020):

It is working for me. But it didn't work in the above case. So I just wanted to enquire if any change in the implementation of the feature is required. But since you have assured me that this key-binding (pertaining to the enter key) will be present by default in the future, I have no further queries.

@ghost commented on GitHub (Mar 10, 2020): It is working for me. But it didn't work in the above case. So I just wanted to enquire if any change in the implementation of the feature is required. But since you have assured me that this key-binding (pertaining to the enter key) will be present by default in the future, I have no further queries.
Author
Owner

@ghost commented on GitHub (Mar 10, 2020):

Going a bit off track: Did you get that piece of code you were looking for?

If you feel everthing is done, you may close this issue now.

@ghost commented on GitHub (Mar 10, 2020): Going a bit off track: Did you get that piece of code you were looking for? If you feel everthing is done, you may close this issue now.
Author
Owner

@DHowett-MSFT commented on GitHub (Mar 24, 2020):

It looks like the questions here have been answered. Right now, you can bind enter to copy, but we're not looking at doing it by default. We are collecting information on how popular certain keybindings are so as to inform our decisions in this space.

Thanks!

@DHowett-MSFT commented on GitHub (Mar 24, 2020): It looks like the questions here have been answered. Right now, you can bind `enter` to `copy`, but we're not looking at doing it by default. We _are_ collecting information on how popular certain keybindings are so as to inform our decisions in this space. Thanks!
Author
Owner

@JonesMikael commented on GitHub (Oct 14, 2021):

Came here to mention the same, I miss the Select + Enter to perform a copy. Just noticed that when we are rolling out Wineows 11 and I'm trying to default to Windows Terminal rather than legacy Powershell. This is bound to be problematic for many users when we start rolling out Windows 11 which includes Windows Terminal as default.

@JonesMikael commented on GitHub (Oct 14, 2021): Came here to mention the same, I miss the Select + Enter to perform a copy. Just noticed that when we are rolling out Wineows 11 and I'm trying to default to Windows Terminal rather than legacy Powershell. This is bound to be problematic for many users when we start rolling out Windows 11 which includes Windows Terminal as default.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#6783