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

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

Closed
ghost opened this issue Mar 8, 2020 · 13 comments
Closed

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

ghost opened this issue Mar 8, 2020 · 13 comments
Labels
Area-Settings Issues related to settings and customizability, for console or terminal Needs-Tag-Fix Doesn't match tag requirements Product-Terminal The new Windows Terminal. Resolution-By-Design It's supposed to be this way. Sometimes for compatibility reasons.

Comments

@ghost
Copy link

ghost commented 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.

@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 Mar 8, 2020
@j4james
Copy link
Collaborator

j4james commented Mar 8, 2020

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

@zadjii-msft
Copy link
Member

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 zadjii-msft added Area-Settings Issues related to settings and customizability, for console or terminal Product-Terminal The new Windows Terminal. labels Mar 9, 2020
@zadjii-msft zadjii-msft changed the title Copy/Paste Operations not working properly Terminal doesn't copy on Enter (like conhost does) Mar 9, 2020
@ghost
Copy link
Author

ghost commented Mar 9, 2020

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

@ghost
Copy link
Author

ghost commented 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.

@zadjii-msft
Copy link
Member

zadjii-msft commented 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

@ghost
Copy link
Author

ghost commented 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.

@zadjii-msft
Copy link
Member

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

@ghost
Copy link
Author

ghost commented 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?

@zadjii-msft
Copy link
Member

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:

else if (point.Properties().IsRightButtonPressed())
{
// copyOnSelect causes right-click to always paste
if (_terminal->IsCopyOnSelectActive() || !_terminal->IsSelectionActive())
{
PasteTextFromClipboard();
}
else
{
CopySelectionToClipboard(shiftEnabled);
}
}

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

@ghost
Copy link
Author

ghost commented 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
Copy link
Author

ghost commented 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.

@DHowett-MSFT
Copy link
Contributor

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 DHowett-MSFT added Resolution-By-Design It's supposed to be this way. Sometimes for compatibility reasons. and removed Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting labels Mar 24, 2020
@JonesMikael
Copy link

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 up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Settings Issues related to settings and customizability, for console or terminal Needs-Tag-Fix Doesn't match tag requirements Product-Terminal The new Windows Terminal. Resolution-By-Design It's supposed to be this way. Sometimes for compatibility reasons.
Projects
None yet
Development

No branches or pull requests

4 participants