I have:
For some commands, pure seems to fail to add it's additional newline:

If I then hide guake and bring it back up, the last line of the output of the previous command disappears:

I'm using i3-wm and the same happens with xterm and termite, if I move it to the scratchpad and bring it back. Or if I resize the window.
This only happens since the update to pure 1.7.0.
curl https://rest.bandsintown.com/.zshrc:autoload -U promptinit; promptinit
prompt pure
I seem to be able to reproduce this with either Pure 1.6.0 or 1.7.0.
By doing: print -n hello world, then resize terminal window.
It seems to be a problem with having the "initial newline" as part of PROMPT. Zsh seems to clear the entire line when the prompt is updated.
This patch should fix it:
diff --git a/pure.zsh b/pure.zsh
index 01c1980..5a9dd64 100644
--- a/pure.zsh
+++ b/pure.zsh
@@ -141,18 +141,15 @@ prompt_pure_preprompt_render() {
local cleaned_ps1=$PROMPT
local -H MATCH MBEGIN MEND
if [[ $PROMPT = *$prompt_newline* ]]; then
- # When the prompt contains newlines, we keep everything before the first
- # and after the last newline, leaving us with everything except the
- # preprompt. This is needed because some software prefixes the prompt
- # (e.g. virtualenv).
- cleaned_ps1=${PROMPT%%${prompt_newline}*}${PROMPT##*${prompt_newline}}
+ # Remove everything from the prompt until the newline. This
+ # removes the preprompt and only the original PROMPT remains.
+ cleaned_ps1=${PROMPT##*${prompt_newline}}
fi
unset MATCH MBEGIN MEND
# Construct the new prompt with a clean preprompt.
local -ah ps1
ps1=(
- $prompt_newline # Initial newline, for spaciousness.
${(j. .)preprompt_parts} # Join parts, space separated.
$prompt_newline # Separate preprompt and prompt.
$cleaned_ps1
@@ -167,7 +164,10 @@ prompt_pure_preprompt_render() {
local expanded_prompt
expanded_prompt="${(S%%)PROMPT}"
- if [[ $1 != precmd ]] && [[ $prompt_pure_last_prompt != $expanded_prompt ]]; then
+ if [[ $1 == precmd ]]; then
+ # Initial newline, for spaciousness.
+ print
+ elif [[ $prompt_pure_last_prompt != $expanded_prompt ]]; then
# Redraw the prompt.
zle && zle .reset-prompt
fi
There are other reasons to apply this patch as well, e.g. https://github.com/sindresorhus/pure/issues/376.
Thank you very much for your fast reply. It's absolutely possible, that this was an issue before 1.7.0 and I was just lucky not running into it.
With your proposed patch, the problem is gone.
Most helpful comment
Thank you very much for your fast reply. It's absolutely possible, that this was an issue before 1.7.0 and I was just lucky not running into it.
With your proposed patch, the problem is gone.