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

PS1="〉" terminal prompt glitches #1156

Closed
2 tasks done
folletto opened this issue Dec 13, 2016 · 21 comments
Closed
2 tasks done

PS1="〉" terminal prompt glitches #1156

folletto opened this issue Dec 13, 2016 · 21 comments

Comments

@folletto
Copy link

  • I am on the latest Hyper.app version

  • I have searched the issues of this repo and believe that this is not a duplicate

  • macOS 10.12.1

  • Hyper.app 1.0.0.1303

  • default .hyper.js

  • Dev Console error: __WEBPACK_IMPORTED_MODULE_0_hterm_umdjs__.hterm.TextAttributes.splitWidecharString
    (full stack screenshot)

  • vanilla Hyper

Issue

When I updated to Hyper 1.0 (from a previous 0.x I can't recall, which worked) the prompt looked off. What's worse, some operations didn't work properly either:

  1. the color of the prompt leaked.
  2. preferences didn't open, just duplicated the same content of the original tab and crashed them all if I attempted to close one (screenshot).
  3. CMD+W and CMD+T seem not working / work randomly.

I hunted the issue down, and removing piece by piece every element in my custom PS1 prompt, I identified it breaks when I add this character: .

Specifically, the smallest bash prompt that breaks is:

PS1="〉"

Might be useful:

$ echo -n 〉| hexdump
0000000 e2 8c aa                                       
0000003

The same happens with:

PS1="〉"

$ echo -n 〉| hexdump
0000000 e3 80 89                                       
0000003

And other random characters:

PS1="、"
PS1="ㄐ"
PS1="㈑"

If I change the prompt to anything else, it works. Similarly, if I keep my prompt but I just remove that character, it works again.

Also: I can't copy paste the above PS1 commands into Hyper either: the paste itself "breaks" at the character.

@dotcypress
Copy link
Contributor

dotcypress commented Dec 13, 2016

Hopefully fixed by #1111

@dotcypress
Copy link
Contributor

dotcypress commented Dec 13, 2016

@folletto could you try to build Hyper from this branch and try again?

@folletto
Copy link
Author

I confirm that branch fixes the issue, but not completely.

The cursor becomes offset by roughly a single space:

Typing ll in Hyper (that unicode-perfomance-fix branch):

screen shot 2016-12-13 at 01 53 48

Typing ll in Hyper 1.0 (with the bug mentioned here):

screen shot 2016-12-13 at 01 55 37

Typing ll in Hyper 1.0 (with a PS1="$ " prompt):

screen shot 2016-12-13 at 01 57 20

Typing ll in Terminal:

screen shot 2016-12-13 at 01 54 04

@dotcypress
Copy link
Contributor

dotcypress commented Dec 13, 2016

@folletto but this space provided by PS1="〉", right?

UPD: NVM

@adityavm
Copy link

adityavm commented Dec 13, 2016

not sure if this is related, but my prompt is:

%{$fg_bold[blue]%}〉%{$fg_no_bold[white]%}%p%{%F{247}%}%c ·%{$reset_color%}

(same '〉' character in the prompt) and my hyper is a blank window

screen shot 2016-12-13 at 9 16 27 am

@folletto
Copy link
Author

folletto commented Jan 1, 2017

With Hyper 1.0.1 (that had #1111 merged) now the prompt has the visual glitch of the space, but at least doesn't break functionality (at least to the extent I tested it).

Current 1.0.1 (notice the misplaced space):

cap-

@cirqueit
Copy link

cirqueit commented Jan 1, 2017

My off-by-one behavoir (seen above in @folletto 's post) was caused when using NOCOLOR in my prompt

NOCOLOR="$(tput sgr0)"

I modified NOCOLOR to instead paint text white

NOCOLOR="$tput setaf 7)"

Now I'm good. Hope it helps!

@storvik
Copy link

storvik commented Jan 3, 2017

Having the same problem as @folletto with 1.0.1 when spawning a tmux session. Invoking the tmux prompt (C-b :) fixes all preceding lines (shifting them one character to the right again), but when entering a new command it's back to being off to the left by one. Using zsh and powerlevel9k.

screen shot 2017-01-03 at 07 19 39

All space between left and right prompt is also removed. Everything works as expected when not in a tmux session.

screen shot 2017-01-03 at 07 28 54

Icon bug is likely related to #1327

@storvik storvik mentioned this issue Jan 6, 2017
2 tasks
@jrop
Copy link

jrop commented Jan 11, 2017

I don't know if this pertains to this issue or not, but I am getting an out-of-place cursor when using tmux after updating to the latest Hyper (1.1.0.1408):

gif

(sorry for the slow replay...I don't know why it plays back so slowly; EDIT: fixed to normal replay speed)

@jrop
Copy link

jrop commented Feb 17, 2017

#1332 seems to be related to this. But there seems to be something more fundamentally wrong:

My PS1 looks like this: "%B%F{green}~%f %F{cyan}λ%f%b "

Note that the %b (</bold>) occurs before the trailing space.

When running outside of TMUX, the generated HTML is:

<x-row><span style="color: rgb(0, 186, 19); font-weight: bold;">~</span><span style="font-weight: bold;"> </span><span class=" unicode-node" style="color: rgb(0, 181, 189); font-weight: bold;">λ</span> <span style="color: rgb(239, 41, 41); font-weight: bold;">asdf</span></x-row>

However when running inside TMUX, the generated HTML is instead:

<x-row><span style="color: rgb(152, 195, 121); font-weight: bold;">~</span><span style="font-weight: bold;"> </span><span class=" unicode-node" style="color: rgb(86, 182, 194); font-weight: bold;">λ</span></x-row>

...until I type a character, it becomes:

<x-row><span style="color: rgb(152, 195, 121); font-weight: bold;">~</span><span style="font-weight: bold;"> </span><span class=" unicode-node" style="color: rgb(86, 182, 194); font-weight: bold;">λ </span><span style="color: rgb(224, 108, 117); font-weight: bold;">asdf</span>         </x-row>

Note that it puts the space within the bold span with the λ character, which is wrong. According to my PS1 string, the space occurs after the bold ends.

Another note, even if the string was in the bold markup, this problem would be fixed if #1332 were fixed.

@adworacz
Copy link

adworacz commented Mar 9, 2017

Oh thank god, I'm not the only one. I'm using the latest (1.2.1.1527) and experiencing this issue when I use TMUX. It's really quite infuriating and works just fine in iTerm.

@adworacz
Copy link

adworacz commented Mar 10, 2017

This is still occurring with 1.3.1. In fact, tmux use in hyper seems quite broken as even my status bar at the bottom is rending oddly, like the window size isn't being communicated to TMUX properly.

@jrop
Copy link

jrop commented Mar 10, 2017

@adworacz I've sadly had to stop using hyper altogether. I am keeping an eye on this issue, however, hoping that the devs fix this! From what I understand, once they switch to xterm.js, this might fix itself (#1275).

@adworacz
Copy link

@jrop I have to agree. I'm continuing to use iTerm for the time being, as I need tmux support in order to work properly.

Thank you for pointing out the potential migration to xterm.js, I'll be sure to track it.

@hugomd
Copy link

hugomd commented Mar 21, 2017

I also have the same issue

@jrop
Copy link

jrop commented May 31, 2017

@adworacz My specific issue is gone in version 1.3.3.

@folletto
Copy link
Author

folletto commented May 31, 2017

Thanks for the update, I checked: the issue is still present in v1.3.3.

screen shot 2017-05-31 at 16 55 16

@adworacz
Copy link

I can't replicate my issue on 1.3.3.

At least, not yet. Will keep experimenting, but thank you for fixing the core issue.

@MelkorNemesis
Copy link

I still keep getting this error on 1.3.3.

@AnonymousArthur
Copy link

I'm getting the same error in 2.0.0 ...

@albinekb
Copy link
Contributor

Please open a new issue for 2.0 @ultran

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests