powerlevel10k icon indicating copy to clipboard operation
powerlevel10k copied to clipboard

vcs is not hidden when using p10k-on-post-prompt in multiline prompt

Open rweglarz opened this issue 3 years ago • 1 comments

First of all thank you for powerlevel10k, it's great.

I'm struggling to hide vcs in multiline prompt.

If I do all in one line - it works:

  typeset -g POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(
    context                 # user@hostname
    dir                     # current directory
    vcs                     # git status
    prompt_char             # prompt symbol
  ) 
    
  function p10k-on-pre-prompt()  {
    p10k display '1/left/*'=show '1/left/prompt_char'=hide
  }

  function p10k-on-post-prompt() {
    p10k display '1/left/*'=hide '1/left/prompt_char'=show                                                                                                             
  }

but this does not:

  typeset -g POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(
    newline                
    newline
    context                 # user@hostname
    dir                     # current directory
    vcs                     # git status
    prompt_char             # prompt symbol
  ) 

  function p10k-on-pre-prompt()  {
    p10k display '3/left/*'=show '3/left/prompt_char'=hide
  }

  function p10k-on-post-prompt() {
    p10k display '3/left/*'=hide '3left/prompt_char'=show                                                                                                             
  }

prompt looks like so (note the dir does get hidden)

 master ?10 ❯ 

 ~/prog/c | master ?10 > 

This also seems to imply it is hidden:

❯ p10k display -a '*' && printf '%-32s = %q\n' ${(@kv)reply} | sort
...
3/left/vcs                       = hide
...

I do have RIGHT_PROMPT but it does not seem to influence this behavior.

thank you

rweglarz avatar Dec 19 '22 21:12 rweglarz

I've reproduced this. vcs does not get hidden if it's on the last line of a multi-line prompt. vcs has special rendering, so there is probably a bug somewhere in that part of the code. No ETA yet.

By the way, you can test this by invoking p10k display '*/vcs'=hide on the command line without hooks.

romkatv avatar Dec 19 '22 22:12 romkatv