hyper: has a '%' in the top left, and themes has bugs in v3.0.
- I am on the latest Hyper.app version
- I have searched the issues of this repo and believe that this is not a duplicate
- OS version and name:
- Hyper.app version:
- Link of a Gist with the contents of your .hyper.js:
- Relevant information from devtools (CMD+ALT+I on macOS, CTRL+SHIFT+I elsewhere):
- The issue is reproducible in vanilla Hyper.app:
Issue
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 23
- Comments: 29
fix it after add : unsetopt PROMPT_SP to my .zshrc file
The problem is that Hyper incorrectly reports terminal size for some short time after the tty is created. Try adding this at the very top of
~/.zshrcand then starting Hyper.Here’s what I get:
My real terminal width is 75 but Hyper says 100 for a short while. If my
~/.zshrcisn’t bloated, then zsh will print the first prompt while thinking that the terminal is 100 characters wide. Ifprompt_crandprompt_spare set (this is the default), zsh will print the following sequence before every prompt.%on inverted background. This is controlled byPROMPT_EOL_MARK. You can putPROMPT_EOL_MARK=Xin~/.zshrcto use the plainXcharacter instead.N - Mspaces, whereNis the terminal width andMis the width ofPROMPT_EOL_MARK(1 by default).\r(carriage return).cetermcap).If this sequence is printed when the cursor is at the very first column, it will simply clear the current line. If the cursor is not on the first column, it’ll append
%to the current line and move the cursor to the beginning of the next line.Now let’s see what happens when the terminal says it’s 100 columns wide when it’s actually only 75 columns wide. Instead of printing
%followed by 74 spaces,\randce(which would have no effect), zsh will print%and 99 spaces. This will wrap around to the next line. The subsequent\randcewill clear the second line but%on the first line will remain.To see this in action, add this at the top of
~/.zshrcand start Hyper.Note: That pesky percent and mangled prompt.
This is not a bug in zsh. If you replace
typeset LINES COLUMNSwith/bin/stty size, you’ll also get wrong data. Or you can even tell Hyper to start/bin/stty sizebypassing the shell. It’ll still report wrong terminal size.I don’t know much about Hyper but does it perchance use VTE? There is a VTE bug that causes very similar issues for all terminals that use it. See https://github.com/gnunn1/tilix/issues/1777.
(Hyper doesn’t export
VTE_VERSION, so probably not using VTE?)If this is indeed a VTE bug, then it makes sense that you wouldn’t see it on macOS. VTE is GNU, a part of GNOME.
Which OS?
I can reproduce it on Linux with VTE version 5605 and Hyper 3.0.2.
Edit: I think Hyper doesn’t use VTE, so it’s an unrelated bug. I’ve also reproduced this problem on macOS with Hyper 3.0.2.
Zsh users affected by this bug can mitigate it by installing powerlevel10k theme and enabling instant prompt through
p10k configure. If you still see broken prompt when starting Hyper, addsleep 1at the end of~/.zshrc. This won’t make zsh startup slower thanks to instant prompt.This is not a problem with oh-my-zsh or missing symbols, so I think this issue shouldn’t have been closed.
It occurs because hyper doesn’t deal with zsh’s option to preserve partial lines correctly (
PROMPT_SP, see http://zsh.sourceforge.net/Doc/Release/Options.html#Prompting), as has been mentioned before.This wasn’t the case in
2.x, so it must’ve been some change in3.xthat causes this incorrect behavior.Using
unsetopt PROMPT_SPis a workaround but not a fix, as the option can be quite useful as mentioned by another user.Other terminal emulators I’ve tried so far on both macOS and Arch Linux (iTerm 2, Alacritty, kitty, Xfce Terminal) don’t seem to suffer from this problem when using the same zsh settings.
This is a bad idea. Consider:
Note that the output of
cat message.txtis missing the second line.It’s a really bad idea to unset
PROMPT_SPin zsh.It’s useful for being able to see if output ends with a new line whilst keeping a consistent feel / appearance to the prompt. In instances where there is no new line, the prompt will continue from the end of the previous output without a line break.
This appears to be a regression since it was fixed in v2: https://github.com/zeit/hyper/issues/2144#issuecomment-382652061.
add
unsetopt PROMPT_SPto your last line of.zshrcwill simply solve itThis was present after a clean install of Catalina on my Hyper as well (as Catalina changed the default shell) and I had to use @CsarGomez fix above to remove it.
Same issue on Hyper 3.0.2, only in the first tab of each new window. I don’t want to use
unsetopt PROMPT_SP, because I really like this ZSH feature.This solution fixed it for me. https://github.com/zeit/hyper/issues/2144#issuecomment-326741620