Powerlevel9k / powerlevel9k

Powerlevel9k was a tool for building a beautiful and highly functional CLI, customized for you. P9k had a substantial impact on CLI UX, and its legacy is now continued by P10k.
https://github.com/romkatv/powerlevel10k
MIT License
13.46k stars 948 forks source link

[next] Enabling bold segments breaks prompt formatting in zsh 5.2 #1302

Open romkatv opened 5 years ago

romkatv commented 5 years ago

This is on next.

  1. Install zsh 5.2.
  2. Make context prompt bold with typeset P9K_CONTEXT_{DEFAULT,ROOT,SUDO,REMOTE_REMOTE_SUDO}_BOLD=true and source p9k. Don't set any other p9k options.

Expected:

expected

Actual:

actual

Syphdias commented 5 years ago

I guess this zsh bug is the culprit.

If somebody wants to work on this. Easy way to reproduce this:

docker run -e LANG=C.UTF-8 -e LC_ALL=C.UTF-8 -e TERM=$TERM -it --rm fedora:25 bash -uexc '
  yum install git zsh --assumeyes
  git clone -b next https://github.com/bhilburn/powerlevel9k.git ~/powerlevel9k
  echo "
    typeset POWERLEVEL9K_CONTEXT_{DEFAULT,ROOT,SUDO}_BOLD=true
    source powerlevel9k.zsh-theme
    " >~/.zshrc
  cd ~/powerlevel9k
  exec zsh'
romkatv commented 5 years ago

Here's my boilerplate for building zsh. This way you can checkout any commit and test it on different platforms. This doesn't create the same global ZSH configs that distributions provide but I've never seen this make a difference in practice.

docker run -e LANG=C.UTF-8 -e LC_ALL=C.UTF-8 -e TERM=$TERM -it --rm ubuntu bash -uexc '
  apt update && apt install -y git build-essential libncurses-dev gcc autoconf man
  git clone -b zsh-5.2 https://github.com/zsh-users/zsh.git ~/zsh
  cd ~/zsh
  ./Util/preconfig
  ./configure
  make -j 20 install.bin install.modules install.fns
  exec zsh'
Syphdias commented 5 years ago

I actually had to search for a distro with zsh 5.2 and it might be best to debug it in an environment where it is actually used.

PS: Also, my version is probably faster 😜

romkatv commented 5 years ago

I actually had to search for a distro with zsh 5.2

Figured. Hence I shared my command so that in the future you can adapt it to anything you like. It also lets you use a combination of OS + ZSH version easily.