Closed Jaakkonen closed 2 years ago
When opening a new terminal, pure first prints a prompt with first line empty and then after couple hundred milliseconds clears the terminal and writes prompt without a empty first line.
The Pure prompt should not re-render itself unless you are in a git
repo (and the actual prompt line changed). Also, the initial newline being erased sounds weird, it's almost as if your prompt setup/terminal is triggering a clear screen event.
A few thoughts:
dash
instead of zsh
in some of those examples?dash
).zshenv
, .zprofile
, .zlogin
, etc?
/etc
?I'd like a option for it to write the prompt without the empty first line the first time it's printed.
See https://github.com/sindresorhus/pure/issues/233#issuecomment-248549416 as to why we can't support this.
Environment details It looks like the
prompt_pure_system_report
reportsdash
as my zsh as it's my/bin/sh
. Here I'm invokingzsh
for a interactive shell directly when launching a terminal.
Zsh version is 5.8 (x86_64-pc-linux-gnu). Arch linux package.
No other Zsh config files in these tests (ZDOTDIR
was placed to a test directory with the .zshrc
and global /etc/zsh/*
and /etc/{zprofile,zshrc,zlogin} do not exist)
I also tried the python PTY debug process in a docker container (archlinux, zsh 5.8, latest pure
main branch tag v1.18.0) with pure cloned to /usr/share/zsh/pure
and zshrc
file as follows
# /etc/zsh/zshrc
fpath+=/usr/share/zsh/pure
autoload -U promptinit
promptinit
prompt pure
with this setup I only got one prompt
>>> from ptyprocess import PtyProcessUnicode
>>> p = PtyProcessUnicode.spawn(['zsh', '-i'])
>>> p.read()
'\x1b]0;(7cac67499309) /\x07\r\n\x1b[0m\x1b[27m\x1b[24m\x1b[J\x1b[39mroot\x1b[39m\x1b[39m@7cac67499309\x1b[39m \x1b[34m/\x1b[39m\r\n\r\x1b[35m❯\x1b[39m \x1b[K\x1b[?2004h'
so the issue seems to be somewhere in my local setup.
Anyway, I cannot reproduce the prompt getting written twice in the docker setup. I'll create a new ticket/reopen/comment if I find a way to reproduce the issue in a simple container.
See #233 (comment) as to why we can't support this.
That makes sense. I cannot come up with a trivial way to distinguish the case where a new empty terminal is launched from the other cases such as ssh
and launching zsh
from other shell.
This answers my question pretty well, for some reason I couldn't find the existing issues that well with GH issue search. Thanks! :)
General information
When opening a new terminal,
pure
first prints a prompt with first line empty and then after couple hundred milliseconds clears the terminal and writes prompt without a empty first line.I'd like a option for it to write the prompt without the empty first line the first time it's printed.
System report (output of
prompt_pure_system_report
):Minimal setup (
zsh -s init.zsh
) withReport:
The problem also happens with
zsh-snap
setup usingSystem report:
Other information
I have:
Problem description
When running Zsh in a terminal with the first minimal config
we see that it outputs the prompt 2 times with the later erasing the another.
In a real terminal you can see that the first part is printed out really fast but the other part follows couple hundred milliseconds late.
Reproduction steps
Run
pure
prompt in a fresh terminal/pty and shell. See that it first creates a empty line and a 2 line prompt and then removes those 3 lines and inserts a 2 line prompt.My
.zshrc
: