-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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 inside PS1 offset cursor by 1 #2587
Comments
Add a space after the emoji, emojis are not monospaced so they can't fit inside a column. If you add a space as "padding" it will look correct 👍 @aaronatmycujoo
|
The problem is still there with the space. Maybe I didn't explain properly :, ) I made a video: https://streamable.com/sgqww The space is in there, but it looks like it is being truncated. When I am in .bash_profile I am deleting the space between the emoji and the " and you can see the " going behind the cat. |
I can't see the error there, maybe someone else can reproduce. Hyper handles emojis like iterm does for me, that's what I expect :) |
I use
and here is my album to help demonstrate once again: |
Oh I see. Can you try running the latest code via our canary release? see https://zeit.co/blog/canary for more info. In there we have changed the terminal rendering lib to |
Hm that does not seem to help. I do not think the problem is with your software? If I compare before and after: This is with an emoji and a space. The emoji seems to take up 2 columns and the cursor does not respects that, but the text does. Maybe it has something to do with: https://www.youtube.com/watch?v=sTzp76JXsoY |
The problem is that Hyper treats all Unicode characters as half-width character, and forces them to fit in .unicode-node {
display: inline-block;
vertical-align: top;
width: 8.4px;
} Apart from emojis, this problem affects all CJK characters because they are full-width. Additionally, when multiple CJK characters appear in sequence, one of the characters is repeated after the last by mistake. For example, paste Also, typing in Hyper with CJK input methods will result in a total mess. Hyper will catch some of the letters into the terminal, prevent the input method bar from appearing, bring strange characters after the cursor, and turn the cursor into yellow. Here is an example with a Chinese input method typed Use one of the CJK input methods to reproduce the bug. |
Nice write up! So it is possible to detect halfwidth unicode characters and only force those to fit into the 8.4px width? Trying to help solve the problem here but I have no experience with this 😅 |
8.4px for half-widths; 16.8px for full-widths. Again, please also look into the other bugs I just mentioned apart from this one. |
There's an NPM package about this: |
As a halfway hack for my setup I just added a I seem to have the most issues when using a 🐛 emoji, see the gif below for the odd rendering that occurs when you paste one in. The irony of a bug emoji causing a bug...
|
Hey there, please try again with the new Hyper v2 release and open a new issue if the problem stills exists. Thank you! |
Thanks for reporting bag! |
@Elderry that looks like xtermjs/xterm.js#1059, right? |
@Stanzilla Nope, I don't think they are the same issue. But I can confirm this problem also happens in vscode, so it's fine to mark this as an upstream issue. |
Seems like in Hyper v2 the terminal is rendered in a canvas instead of with CSS. The problem with CJK characters has been fixed. |
About emoji unicode version and its width problem, tested successful in my local build... |
For me the issue has been sovled with 2.1.0-canary.3 🎉 |
Fixed in #4679 |
I am still hitting this isse in Hyper 3.0.2 on stable and on canary. PROMPT='%F{yellow}%/ 👻 %f' Notice the space after the ghost. It appears in hyper like so: You can see the ghost is taking up two character spaces. If I replace the ghost with a letter, like To compare, this is what it looks like in my IDE. Ghost+space+"clear" against "A"+space+"clear". |
Issue
If I include an emoji inside PS1 my terminal cursor has an offset of 1.
export PS1="\w " # works
export PS1="\w 🐱" # issue
Any idea on what to do?
I took a screenshot to show the issue: https://imgur.com/a/Z2yxV
The text was updated successfully, but these errors were encountered: