pure icon indicating copy to clipboard operation
pure copied to clipboard

Prompt corrupted during command completion (Mac, iTerm)

Open thistlillo opened this issue 1 year ago • 2 comments

General information

prompts get corrupted during command completion

System report (output of prompt_pure_system_report):

  • Zsh: zsh 5.9 (x86_64-apple-darwin23.0) (/bin/zsh)
  • Operating system: macOS 14.1.2 (23B92)
  • Terminal program: iTerm.app (3.4.22)
  • Tmux: no
  • Git: git version 2.39.3 (Apple Git-145)
  • Pure state:
    • username: ''
    • prompt:
    • version: 1.22.0
  • zsh-async version: 1.8.6
  • PROMPT: typeset -g PROMPT=$'%F{${prompt_pure_colors[path]}}%~%f %}%(12V.%F{$prompt_pure_colors[virtualenv]}%12v%f .)%(?.%F{$prompt_pure_colors[prompt:success]}.%F{$prompt_pure_colors[prompt:error]})${prompt_pure_state[prompt]}%f %{%}'
  • Colors: typeset -g -A prompt_pure_colors=( [execution_time]=yellow [git:action]=yellow [git:arrow]=cyan [git:branch]=195 [git:branch:cached]=red [git:dirty]=218 [git:stash]=cyan [host]=242 [path]=195 [prompt:continuation]=242 [prompt:error]=red [prompt:success]=magenta [suspended_jobs]=red [user]=242 [user:root]=default [virtualenv]=195 )
  • TERM: export TERM=xterm-256color
  • Virtualenv: export VIRTUAL_ENV_DISABLE_PROMPT=12
  • Conda: export CONDA_CHANGEPS1=no
  • Detected frameworks: None

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.

  • [X] Tested with another terminal program and can reproduce the issue:
  • [X] Followed the integration instructions for my framework

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
#)

thistlillo avatar Dec 08 '23 19:12 thistlillo

@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.

olegtarasov avatar Dec 09 '23 09:12 olegtarasov

@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.

thistlillo avatar Dec 09 '23 10:12 thistlillo