sindresorhus / pure

Pretty, minimal and fast ZSH prompt
MIT License
13.12k stars 971 forks source link

Prompt corrupted during command completion (Mac, iTerm) #666

Open thistlillo opened 10 months ago

thistlillo commented 10 months ago

General information

prompts get corrupted during command completion

System report (output of prompt_pure_system_report):

Other information

I made a search here and could not find open issues related to this. I have found a similar question on Stackoverlow and tried the suggestion given there. I added:

export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8

to ~/.profile, but with no effects.

Besides the pure prompt, I have no other alternative prompts installed. The problem only occurs with pure.

I have:

I use pure only with iterm.

Problem description

When using pure prompt within iterm2, typing a command (e.g. cd) then TAB twice, the command name is left in the prompt and cannot be removed.

This is what I mean (cd + tab + tab):

Screenshot 2023-12-08 at 20 07 06

This is what I see after typing "backspace" four times (or more):

Screenshot 2023-12-08 at 20 07 24

Reproduction steps

  1. type a command name
  2. hit tab
  3. hit tab

My .zshrc:

autoload -U promptinit; promptinit
prompt pure

zstyle :prompt:pure:virtualenv color 195
zstyle :prompt:pure:git:branch color 195
zstyle :prompt:pure:path color 195

#plugins=(
#    # other plugins...
#    zsh-autosuggestions
#)
olegtarasov commented 10 months ago

@thistlillo I got the same bug on a clean install today. The solution is indeed to set LC_ALL and LANG variables, but not in .profile, since zsh doesn't load that file. You can set those variables either in .zshrc or in .zprofile. Setting them at the beginning of .zshrc fixed the bug for me.

thistlillo commented 10 months ago

@thistlillo I got the same bug on a clean install today. The solution is indeed to set LC_ALL and LANG variables, but not in .profile, since zsh doesn't load that file. You can set those variables either in .zshrc or in .zprofile. Setting them at the beginning of .zshrc fixed the bug for me.

Thank you, I will do as you say. Sorry for not having tested that.

I realized the positions of the two screenshots were inverted and modified my post to correct that.