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

Emojis can get cut off in the terminal #35102

Closed
alexdima opened this issue Sep 26, 2017 · 9 comments
Closed

Emojis can get cut off in the terminal #35102

alexdima opened this issue Sep 26, 2017 · 9 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug terminal Integrated terminal issues upstream Issue identified as 'upstream' component related (exists outside of VS Code) verified Verification succeeded

Comments

@alexdima
Copy link
Member

Testing #34868

emoji-test.txt

  • save this file as UTF8 with bom (I think it is already)
  • configure "terminal.integrated.scrollback": 5000
  • run chcp 65001
  • run cat emoji-test.txt

Observe:

cut emojis e.g.

image

combining sequences that Chromium supports e.g.

image

@alexdima alexdima added the terminal Integrated terminal issues label Sep 26, 2017
@Tyriar
Copy link
Member

Tyriar commented Sep 26, 2017

@alexandrudima what font is this with? For all the monospace fonts I've tested they consistently only cover 2 cells.

Skin tone modifiers are not just a matter of joining the characters in the terminal as the shell doesn't understand that these characters are one. This is as designed for the time being as we're relying on the older tech in shells. See xtermjs/xterm.js#942

@Tyriar Tyriar added the info-needed Issue requires more information from poster label Sep 26, 2017
@alexdima
Copy link
Member Author

@Tyriar Did you attempt to reproduce this given the steps I have provided ? I did not customize the font, otherwise I would have mentioned it.

@Tyriar
Copy link
Member

Tyriar commented Sep 27, 2017

@alexandrudima I don't have access to a Windows machine, trying to get enough information to fix without access.

@Tyriar Tyriar removed the info-needed Issue requires more information from poster label Sep 27, 2017
@Tyriar Tyriar added this to the Backlog milestone Sep 27, 2017
@Tyriar Tyriar added the bug Issue identified by VS Code Team member as probable bug label Sep 27, 2017
@Tyriar Tyriar changed the title Multiple problems with emojis in the integrated terminal on Windows Emojis can get cut off in the terminal Sep 27, 2017
@alexdima
Copy link
Member Author

alexdima commented Sep 27, 2017

Sure, if it helps it is also reproducible on OSX with default settings with this:

2639 FE0F                                  ; fully-qualified     # ☹️ frowning face

image

@Tyriar
Copy link
Member

Tyriar commented Sep 27, 2017

Ah I can reproduce as well, seems that not all emojis are being handled correctly:

screen shot 2017-09-27 at 9 38 39 am

This may have been introduced in xtermjs/xterm.js@c4da832#diff-59a6c78910b740a7b8381b034eeb73a2. Chars are now drawn and their dimensions measured to see if they consume the following cell. Previously I used this regex to test if it was an emoji:

char.search(/([\uD800-\uDBFF][\uDC00-\uDFFF])/g) >= 0;

@Tyriar Tyriar modified the milestones: Backlog, September 2017 Sep 27, 2017
@Tyriar Tyriar added the upstream Issue identified as 'upstream' component related (exists outside of VS Code) label Sep 27, 2017
@alexdima
Copy link
Member Author

@Tyriar this is how I look for emojis in the editor input:

/**
 * Generated using https://github.com/alexandrudima/unicode-utils/blob/master/generate-emoji-test.js
 */
const CONTAINS_EMOJI = /(?:[\u231A\u231B\u23F0\u23F3\u2600-\u27BF\u2B50\u2B55]|\uD83C[\uDDE6-\uDDFF\uDF00-\uDFFF]|\uD83D[\uDC00-\uDE4F\uDE80-\uDEF8]|\uD83E[\uDD00-\uDDE6])/;

export function containsEmoji(str: string): boolean {
	return CONTAINS_EMOJI.test(str);
}

if (/\uFE0F/.test(potentialEmojiInput) || strings.containsEmoji(potentialEmojiInput)) {
  // it is probably an emoji
}

@Tyriar
Copy link
Member

Tyriar commented Sep 27, 2017

@alexandrudima thanks for this, I'll probably just test this before doing the actual measure (which covers other unicode chars) 👍

@Tyriar
Copy link
Member

Tyriar commented Sep 28, 2017

Turns out this was already fixed upstream, I just wasn't on the latest. Fixed in f9a040f

@Tyriar Tyriar closed this as completed Sep 28, 2017
@Tyriar
Copy link
Member

Tyriar commented Sep 28, 2017

No plan to fix the issue where the emoji is so width is expands beyond 2 cells. I'll keep it in mind though if we tweak the cell ownership model.

@octref octref added the verified Verification succeeded label Sep 28, 2017
@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 17, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug terminal Integrated terminal issues upstream Issue identified as 'upstream' component related (exists outside of VS Code) verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

3 participants