prezto icon indicating copy to clipboard operation
prezto copied to clipboard

prompt module eats unterminated lines

Open adrian-amaglio opened this issue 6 years ago • 5 comments

Description

When the prompt module is activated, the last line of a text output is not displayed if it does not end with a newline.

Expected behavior

> echo -n test
test
>

Actual behavior

> echo -n test

>

Steps to Reproduce

  1. Check you have the prompt module in your .zpreztorc
  2. Type echo -n test

Versions

  • Prezto commit: e6eea17b12d18775cb26df7f0eddcf4d9b5cc59d
  • ZSH version: 5.6.2
  • OS information: arch

Related issues

Somebody here seems to have an idea of what is going on but since I am very new to zsh, I don’t understand what it is about.

adrian-amaglio avatar Nov 20 '18 14:11 adrian-amaglio

I can confirm that the issue does occur in 5.6.2 (OS choice doesn't matter - tested on Arch, Debian, and OSX 10.13). However, this only appears to affect the default prompts provided by zsh, as well as, agnoster, powerline, and pure. This appears to be an upstream issue as the prompts that are handled directly by prezto (e.g. anything here that isn't a submodule - https://github.com/sorin-ionescu/prezto/tree/master/modules/prompt/functions) work as expected. Have you seen this happen using the default sorin theme?

johnpneumann avatar Nov 29 '18 22:11 johnpneumann

It's a bit buried in the thread Adrian linked, but this was a change in default behavior for zsh in 5.4.2. You can restore the previous behavior with setopt prompt_sp

See: http://zsh.sourceforge.net/Doc/Release/Options.html#Prompting

jeffcox avatar Dec 05 '18 20:12 jeffcox

Thanks @jeffcox! Not near a computer, so can that just be set in zshrc? Also, should we update prompts to respect the default behaviour or leave as is and make a note that this behaviour exists for those prompts?

johnpneumann avatar Dec 06 '18 02:12 johnpneumann

@johnpneumann Yeah, I just added it to my zshrc. I think if a prompt assumes the old default it would make sense to set it there, but I don't understand why the zsh maintainers changed this so I can't speak to how good an idea it is.

jeffcox avatar Dec 06 '18 20:12 jeffcox

I use pure as prompt theme & I had to run setopt prompt_sp && setopt prompt_cr to restore the previous behavior.

burgesQ avatar Dec 06 '18 20:12 burgesQ