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 949 forks source link

Disappear the last line when using without a new line (\n) #1360

Open Dongsoon-Shin opened 4 years ago

Dongsoon-Shin commented 4 years ago

Hi, this is not a serious bug. However, It bothers me.

OS: Ubuntu 16.04 This is my .zshrc configuration

POWERLEVEL9K_MODE='awesome-fontconfig'
POWERLEVEL9K_MULTILINE_FIRST_PROMPT_PREFIX="↱"
POWERLEVEL9K_PROMPT_ON_NEWLINE=true  
POWERLEVEL9K_RPROMPT_ON_NEWLINE=true  
POWERLEVEL9K_MULTILINE_LAST_PROMPT_PREFIX="↳ "  
POWERLEVEL9K_PROMPT_ADD_NEWLINE=true

and I typed this code for testing.

#include <stdio.h>
main() { 
int a,b;
scanf("%d %d, &a, &b);
printf("%d", a+b);
}

then I compiled with clang and GCC. I was guessed that if put the 5 8, this program will show that 13. However, I show the result like that:

image

The result is disappeared. However, in bash, this result appears.

image

I guess this is a bug. So, I report this bug.

romkatv commented 4 years ago

This is the expected ZSH behavior with options no_prompt_sp and prompt_cr. You can observe it by typing zsh -df --no_prompt_sp --prompt_cr and then echo -n 'hello\nbye'. It's almost always a bad idea to use this set of options.

You can get the same behavior in ZSH as in Bash with no_prompt_sp and no_prompt_cr. It is quite terrible and is unlikely to appeal to anyone.

The best combination is prompt_sp and prompt_cr, which is also the default. So the practical advice is to either add setopt prompt_sp at the end of your ~/.zshrc or remove whatever it is that unsets this option in the first place.