Multiple prompt newlines when opening new iTerm window
- iTerm2 version: Build 3.3.20190102-nightly
- OS version: 10.14.2
- zsh version: 5.6.2
I am developing a zsh prompt theme (https://github.com/mengelbrecht/slimline) which uses zsh-async to calculate separate prompt parts and re-renders the prompt after a part was completed. This is done by calling
zle && zle .reset-prompt for each completed part.
When opening a new iTerm window the
reset-prompt call does not replace the current prompt but causes a newline and the new prompt is rendered on the next line. Since the
reset-prompt call is made multiple times this leads to multiple prompt lines in total. These prompts can be seen when scrolling up after opening the iTerm window.
This issue does only occur when opening a new iTerm window and the prompt is the first line in the terminal (if zsh prints
Last Login: <date> as first line this can be disabled by calling zsh with the
When inserting an
echo "foo" before loading the prompt theme the issue is resolved.
exec zsh -i in an existing iTerm window does not show this behaviour. Also I could not reproduce it in Terminal.app.
After cloning https://github.com/mengelbrecht/slimline a minimal
.zshrc config looks like this:
The workaround by adding an echo:
echo "foo" source <path-to-slimline>/slimline.zsh