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

No emoji in bash prompt when launch #645

Closed
trstringer opened this issue Aug 21, 2016 · 12 comments
Closed

No emoji in bash prompt when launch #645

trstringer opened this issue Aug 21, 2016 · 12 comments
Labels
help wanted Contributions wanted towards the issue 🐛 Type: Bug Issue pertains to something wrong within Hyper

Comments

@trstringer
Copy link

I'm seeing an interesting thing. My bash prompt I have configured an emoji in it, and when launching hyperterm it doesn't recognize it immediately, but it does for all subsequent prompts. See the screenshot below that shows the repro:

screen shot 2016-08-21 at 6 46 26 pm

@timothyis timothyis added 🐛 Type: Bug Issue pertains to something wrong within Hyper help wanted Contributions wanted towards the issue labels Aug 24, 2016
@kimumetal
Copy link

I want to work on this issue.
I discovered that:

  1. When there is no \n in .bash_profile, this bug does not appear.
    2016-09-10 1 51 37
    I can reproduce the same bug when there is \n in .bash_profile.
    2016-09-10 1 49 43

@3j14
Copy link

3j14 commented Sep 11, 2016

Can you show us your .bash_profile?

@trstringer
Copy link
Author

@Jonas-Drotleff here it is:

export PS1="\u@\h 🌺  \w 
 $ "

@christanaka
Copy link

christanaka commented Oct 28, 2016

I have an issue where using ⚡️(high voltage) always shows ⚡︎ (high voltage sign) instead.

# .bash_profile
export PS1='⚡️ \W '

@3j14
Copy link

3j14 commented Oct 29, 2016

@chrishtanaka This is because you use a font that actually has a symbol for the ⚡️ unicode character. The system will always use the font's icons first and if they don't exist, it will take a fallback font, which is the emoji font on macOS

@christanaka
Copy link

@Jonas-Drotleff How would I determine which fonts have symbols for ⚡️ without trying out each one in hyper?

@3j14
Copy link

3j14 commented Nov 1, 2016

@chrishtanaka

This is what I found on the web:

Basically you just have to try...

@simeydotme
Copy link

To add to this issue, I find the same thing with any unicode character, even if I try to encode it myself.

PS1="$ " # no problem
PS1="" # problem
PS1=$'\xe2\x9d\xad\x0a ' # problem

The error I see in console is:
screen shot 2016-12-19 at 11 27 31 am

I stepped through the loop, and find that it's running conversion fine on a bunch of characters (although they seem unrelated?) but then it gets to an undefined and finally crashes. This method (lib.UTF8Decoder.prototype.decode) doesn't seem to run when entering a new line in to the terminal, but only upon opening a new tab.

@simeydotme
Copy link

simeydotme commented Dec 19, 2016

Ah, think I've spotted the issue
maybe; I have no idea how to test as the console crashes every time I try to re-compile the code, so I can't patch;

__WEBPACK_IMPORTED_MODULE_0_hterm_umdjs__["hterm"].Terminal.IO.prototype.writeUTF8

screen shot 2016-12-19 at 11 40 26 am

This method here, the loop is using <= on the length of the string ... (10 for me) but it's zero-indexed and incrementing, meaning the last iteration always has an undefined value because it's looking for length + 1 .

I suspect changing the <= to a < should resolve this issue :)

@zpnk
Copy link

zpnk commented Dec 21, 2016

Seeing the same issue here. Simple repro:

# ~/.bash_profile
export PS1='\n 💭 '

Results in:

screen shot 2016-12-21 at 12 13 28 pm

With the same error as @simeydotme : Uncaught TypeError: Cannot read property 'length' of undefined

screen shot 2016-12-21 at 12 11 59 pm

Like @vwvww mentioned, removing the newline \n "fixes" it. Removing the unicode character while keeping the \n also "fixes" it, but obviously neither are real solutions.

For those bothered by this bug a temporary remedy is to add a clear statement the end of your profile which will cause the buggy prompt to be cleared when a new tab/window is opened:

# ~/.bash_profile
export PS1='\n 💭 '
clear

Looks to me like the lib.UTF8Decoder.prototype.decode needs to be fixed to handle \n.

@simeydotme
Copy link

I think this is fixed by #1366 :)
(at least it's fixed in the latest version; 1.1.0, for me)

@ppot
Copy link
Contributor

ppot commented Jan 11, 2017

Thanks @simeydotme

@ppot ppot closed this as completed Jan 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Contributions wanted towards the issue 🐛 Type: Bug Issue pertains to something wrong within Hyper
Projects
None yet
Development

No branches or pull requests

8 participants