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

What is best way to send emoji to sendInput action? #8809

Closed
krave1986 opened this issue Jan 16, 2021 · 7 comments
Closed

What is best way to send emoji to sendInput action? #8809

krave1986 opened this issue Jan 16, 2021 · 7 comments
Labels
Area-Input Related to input processing (key presses, mouse, etc.) Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. Issue-Question For questions or discussion Needs-Attention The core contributors need to come back around and look at this ASAP. Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Product-Terminal The new Windows Terminal. Resolution-Answered Related to questions that have been answered

Comments

@krave1986
Copy link

Description of the new feature/enhancement

Open vscode to edit the settings.json file.
Locate "actions" property in json file and add this one:

      {
            "command": {
                "action": "sendInput",
                "input": "\"🚀\""

            },
            "keys": "ctrl+l"
        }

What I need to do to print emoji would be

        {
            "command": {
                "action": "sendInput",
                "input": "\"`u{1F680}\"\r"
            },
            "keys": "ctrl+l"
        }

Is it the best way to set emoji as argument of sendInput action? Or is there any better way to do that?

@krave1986 krave1986 added the Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. label Jan 16, 2021
@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 Jan 16, 2021
@DHowett
Copy link
Member

DHowett commented Jan 17, 2021

The correct way to input an emoji depends on what you are doing. The first one works fine for sending the rocket emoji 🚀 with " on either side. The second one works fine for sending the character code of the rocket emoji in PowerShell's unicode escape format also wrapped in ". Both of those are different from sending the rocket emoji on its own.

What are you trying to do, and what's happening?

Is this the same report as #8808?

@DHowett DHowett added the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Jan 17, 2021
@krave1986
Copy link
Author

krave1986 commented Jan 17, 2021

For this issue here, I would like to edit settings.json mostly within vscode which supports emoji well. So as to my use case, I just want to print emoji by pressing a shortcut key. I thought sendInput action could be my solution. While doing this, I found that I am not able to simply copy 🚀 and paste it into vscode to finish the job. Instead, I have to convert 🚀 into, like you mentioned, PowerShell's unicode escape format `u{1F680} and wrap it with " to make it work.

Is it possible to get rid of the convertion step?

For #8808 , I want copy 🚀 and paste it into terminal.
What I desire is:
image

What I got is:
image

@ghost ghost added Needs-Attention The core contributors need to come back around and look at this ASAP. and removed Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something labels Jan 17, 2021
@zadjii-msft
Copy link
Member

Oh so the real problem here is that fundamentally, the console doesn't support emoji input currently. See #190, #1503. So even if the Terminal knows how to handle emoji correctly, the underlying console is going to mangle them before powershell/cmd has a chance to read them and display them.

/dup #190
/dup #1503

@ghost
Copy link

ghost commented Jan 19, 2021

Hi! We've identified this issue as a duplicate of another one that already exists on this Issue Tracker. This specific instance is being closed in favor of tracking the concern over on the referenced thread. Thanks for your report!

@ghost ghost closed this as completed Jan 19, 2021
@ghost ghost added Resolution-Duplicate There's another issue on the tracker that's pretty much the same thing. and removed 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 Needs-Attention The core contributors need to come back around and look at this ASAP. labels Jan 19, 2021
@zadjii-msft zadjii-msft added Area-Input Related to input processing (key presses, mouse, etc.) Issue-Question For questions or discussion Needs-Attention The core contributors need to come back around and look at this ASAP. Needs-Tag-Fix Doesn't match tag requirements Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Product-Terminal The new Windows Terminal. Resolution-Answered Related to questions that have been answered and removed Resolution-Duplicate There's another issue on the tracker that's pretty much the same thing. labels Jan 19, 2021
@ghost ghost removed the Needs-Tag-Fix Doesn't match tag requirements label Jan 19, 2021
@krave1986
Copy link
Author

Hi, @zadjii-msft , could you please shed some light on my issue about sendInput ?

For this issue here, I would like to edit settings.json mostly within vscode which supports emoji well. So as to my use case, I just want to print emoji by pressing a shortcut key. I thought sendInput action could be my solution. While doing this, I found that I am not able to simply copy 🚀 and paste it into vscode to finish the job. Instead, I have to convert 🚀 into, like you mentioned, PowerShell's unicode escape format `u{1F680} and wrap it with " to make it work.

Is it possible to get rid of the convertion step?

Is there an easy way to use emoji in settings.json as input for sendInput action?

@zadjii-msft
Copy link
Member

Not really - at the end of the day, the console is going to mangle the emoji in the input line. So you should be able to just have emoji directly in the file. However, that won't work today, because of the previously mentioned bugs. The console (and Terminal) can handle emoji output perfectly well, but emoji input doesn't work nearly as well.

@krave1986
Copy link
Author

Got it. Thanks for the clarification.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Input Related to input processing (key presses, mouse, etc.) Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. Issue-Question For questions or discussion Needs-Attention The core contributors need to come back around and look at this ASAP. Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Product-Terminal The new Windows Terminal. Resolution-Answered Related to questions that have been answered
Projects
None yet
Development

No branches or pull requests

3 participants