zsh clears previous line of prompt

430 views Asked by At

I have a multi-line prompt in zsh. I've found that sometimes when I CTRL-C out of an autocompletion the previous line of the prompt gets erased unexpectedly. Here's a gif showing this happening with ls, vim and fzf: http://imgur.com/1jTrrzA

Here's an outline of events that happen:

  1. ls all the files
  2. ls then tab complete and CTRL-C out of the first completion (previous line of prompt gets erased)
  3. ls then tab complete and CTRL-C out of the second completion. The previous line of the prompt doesn't get erased
  4. same as step 2 but with vim instead
  5. same as step 3 but I hit Enter instead of CTRL-C, this is my mistake. However, if I CTRL-C out of this example (the not-first completion) the previous line isn't erased
  6. Show how fzf suffers from the same problem several times

I've found that the issue as shown during step 2 and step 4 still exists with a single line prompt. However fzf isn't broken with a single line prompt.

My entire prompt can be found at http://pastebin.com/JwufRy6m which is a modified version of https://github.com/sorin-ionescu/prezto/blob/master/modules/prompt/functions/prompt_sorin_setup to work with mercurial repositories at my company. The lines of interest (I think) in my prompt file are 166 and 167 (line 167 == line 166 minus $prompt_newline).

I've tried creating a multiline prompt without using $prompt_newline by doing:

NEWLINE=$'\n'
PROMPT=.....${NEWLINE}....

But that didn't help either which kinda makes sense to me because part of the problem still exists with single-line prompts.

0

There are 0 answers