Terminal: Typing emoji breaks cursor position

Created on 7 May 2019  ·  7Comments  ·  Source: microsoft/terminal

  • Your Windows build number: (Type ver at a Windows Command Prompt)
Microsoft Windows [Version 10.0.18362.86]
  • What you're doing and what's happening: (Copy & paste specific commands and their output, or include screen shots)

Trying to type something like this into the new Windows Terminal

echo "I💙MS"

When I bring up the emoji keyboard, it doesn't interact with the terminal properly at all, but after I close it, I do get the character I selected.

The problem is that the console acts as if the emoji is double-character-width, and after the emoji, shows the cursor a character to the left of where it should be. More emoji? Further to the left. Eventually it becomes impossible to work because you can't tell where your cursor really is.

  • What's wrong / what should be happening instead:

Emoji should be treated as a character and the bar/cursor should go to the right place.

NOTE: not shell-specific

Area-Input Issue-Bug Needs-Author-Feedback Needs-Repro No-Recent-Activity Priority-2 Product-Conhost Product-Conpty v1-Scrubbed

Most helpful comment

I'm in the process of fixing some of our emoji input when running cmd.exe. What's happening is that while the output buffer can store UTF-16 surrogate pairs, conhost.exe has an edit buffer cmd.exe's prompt that can't yet understand the surrogate pairs. The difference between ❤ and 💙 is that the red heart is not a surrogate pair while the blue heart is.

I'm not 100% sure this is a conpty problem to be honest, at least for cmd.exe it has to do with conhost managing some of cmd's interactive features.

All 7 comments

I get a different error when I try to use the emoji keyboard (win+period), but I'm compiled with v142 toolset and I retargeted all SDKs to 18362. I get this:

conhost_abort

But the shell doesn't terminate outright, I can ctrl+t to bring up another tab but the target tab for input is hosed afaict.

This is a combo of things:

  • [ ] The emoji keyboard interacts poorly with the Windows Terminal
  • [ ] Emoji roundtrip poorly through conpty, causing the cursor position to be wrong.
  • [ ] Trying to type emoji (in powershell) in Windows Terminal causes the attached conpty to crash

Am I missing anything?

I can get mine to echo:
"I❤MS"
but not:
"I💙MS"

I am looking closer at it, it is buggy for sure.

Edit:
They don't seem to render the same in my browser either.
"I❤MS" is "I❤MS" when using code syntax.
"I💙MS" is "I💙MS" when using code syntax.

Firefox Developer Edition 67.0b17 (64-bit)


Microsoft Windows [Version 10.0.18362.86]

I'm in the process of fixing some of our emoji input when running cmd.exe. What's happening is that while the output buffer can store UTF-16 surrogate pairs, conhost.exe has an edit buffer cmd.exe's prompt that can't yet understand the surrogate pairs. The difference between ❤ and 💙 is that the red heart is not a surrogate pair while the blue heart is.

I'm not 100% sure this is a conpty problem to be honest, at least for cmd.exe it has to do with conhost managing some of cmd's interactive features.

Hey so this issue was filed like 10 months ago, and there have been a ton of changes to the Terminal, conhost and conpty since then. Is anyone still seeing this?

image

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.

Was this page helpful?
0 / 5 - 0 ratings