Same here, version: Hyper 3.0.0 (stable)
This appears to be a regression since it was fixed in v2: https://github.com/zeit/hyper/issues/2144#issuecomment-382652061.
Yes, I experience the same issue
A git bisect
run says cba4c66a4b9352acc37433a8b411474599b02bc6 is the first known bad commit.
I've tinkered a bit more and it seems the culprit is that a 'session data'
event is emitted when calling to initialSession.flushEvents()
, with the data
being the options.uid
. Here's what I get if I console.log
initialSession
:
{ session:
Session {
_events:
{ data: [Function: handleData], exit: [Function: handleExit] },
_eventsCount: 2,
_maxListeners: undefined,
pty:
UnixTerminal {
_internalee: [EventEmitter],
_socket: [PipeSocket],
_pid: 26028,
_fd: 34,
_pty: '/dev/pts/1',
_file: '/usr/bin/zsh',
_name: 'xterm-256color',
_readable: true,
_writable: true },
batcher:
DataBatcher {
_events: [Object],
_eventsCount: 1,
_maxListeners: undefined,
uid: '5d504086-c418-4110-b83c-adcff74310c5',
decoder: [StringDecoder],
data: '5d504086-c418-4110-b83c-adcff74310c5',
timeout: null },
shell: '/usr/bin/zsh',
ended: false },
options:
{ rows: 40,
cols: 100,
cwd: '/home/marc',
splitDirection: undefined,
shell: '',
shellArgs: [ '--login' ],
uid: '5d504086-c418-4110-b83c-adcff74310c5' },
flushEvents: [Function: flushEvents] }
And the only event in initialEvents
:
console.log(`"${args[0]}": ${args[1]}`);
"session data": 5d504086-c418-4110-b83c-adcff74310c5
I don't know what any of this means but I hope it's helpful to you.
Same issue here on 3.0 on Mac.
+1
This solution fixed it for me.
https://github.com/zeit/hyper/issues/2144#issuecomment-326741620
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.
Same issue on Hyper 3.0.2, only in the first tab of each new window.
I don't want to useunsetopt PROMPT_SP
, because I really like this ZSH feature.
Can you explain why you might want to keep this?
Same issue on Hyper 3.0.2, only in the first tab of each new window.
I don't want to useunsetopt PROMPT_SP
, because I really like this ZSH feature.Can you explain why you might want to keep this?
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.
Please try a CI canary build
I have the same issue, any way to fix it?
That looks like an issue with your oh-my-zsh and not with hyper. looks like your font is missing a symbol or so?
fix it after add :
unsetopt PROMPT_SP
to my .zshrc file
That looks like an issue with your oh-my-zsh and not with hyper. looks like your font is missing a symbol or so?
This 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.
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 in 3.x
that causes this incorrect behavior.
Using unsetopt PROMPT_SP
is 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.
@Tyriar is that a xterm problem?
The strange thing is that it only happens on the first tab, when I open a new tab it works.
So it's definitely a hyper problem.
I can't reproduce this on 3.0.2 canary. I do can.
I've just tested version 3.1.0-canary.1 on macOS and it works fine.
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 ~/.zshrc
and then starting Hyper.
typeset LINES COLUMNS
sleep 1
typeset LINES COLUMNS
Here's what I get:
LINES=40
COLUMNS=100
LINES=20
COLUMNS=75
My real terminal width is 75 but Hyper says 100 for a short while. If my ~/.zshrc
isn't bloated, then zsh will print the first prompt while thinking that the terminal is 100 characters wide. If prompt_cr
and prompt_sp
are set (this is the default), zsh will print the following sequence before every prompt.
%
on inverted background. This is controlled by PROMPT_EOL_MARK
. You can put PROMPT_EOL_MARK=X
in ~/.zshrc
to use the plain X
character instead.N - M
spaces, where N
is the terminal width and M
is the width of PROMPT_EOL_MARK
(1 by default).\r
(carriage return).ce
termcap).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, \r
and ce
(which would have no effect), zsh will print %
and 99 spaces. This will wrap around to the next line. The subsequent \r
and ce
will clear the second line but %
on the first line will remain.
To see this in action, add this at the top of ~/.zshrc
and start Hyper.
PROMPT'>>>'
RPROMPT='<<<'
return
Note: That pesky percent and mangled prompt.
This is not a bug in zsh. If you replace typeset LINES COLUMNS
with /bin/stty size
, you'll also get wrong data. Or you can even tell Hyper to start /bin/stty size
bypassing 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?)
I've just tested version 3.1.0-canary.1 on macOS and it works fine.
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.
I can't reproduce this on 3.0.2 canary.
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, add sleep 1
at the end of ~/.zshrc
. This won't make zsh startup slower thanks to instant prompt.
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
~/.zshrc
and then starting Hyper.typeset LINES COLUMNS sleep 1 typeset LINES COLUMNS
I tried to add this to the top of .zshrc
, and as you pointed out, after opening a new Hyper 3.0.2 window (on MacOS), it reports an incorrect terminal size. Furthermore the size reported does not change even after the sleep
command (I tried with sleep
longer than 1 second, up to 10 seconds, too). Then, I realised that other Zsh features don't work, such as auto-completion, which is rendered strangely, just as if the size of the terminal did not match the actual size.
Here is a screenshot (my terminal size is 80x24):
While opening a new tab in the same window, the size is correctly reported and the autocompletion works as expected.
Then I tried the 3.1.0-canary.1
version of Hyper again.
As you can see, the window size is correctly reported and in fact the %
does not appear.
But when I use auto-completion (which in this version is rendered well), the command, in this case cd
, is printed 2 times in the prompt. Probably this is an unrelated bug of this canary version.
Apparently in the canary the problem of the %
sign has already been solved; another problem has emerged though...
add unsetopt PROMPT_SP
to your last line of .zshrc
will simply solve it
add
unsetopt PROMPT_SP
to your last line of.zshrc
will simply solve it
This is a bad idea. Consider:
❯ unsetopt prompt_sp
❯ printf 'Hello World\nGoodbye' >message.txt
❯ cat message.txt
Hello World
❯ █
Note that the output of cat message.txt
is missing the second line.
It's a really bad idea to unset PROMPT_SP
in zsh.
Most helpful comment
fix it after add :
unsetopt PROMPT_SP
to my .zshrc file