Search code examples
zshiterm2oh-my-zshmacos-high-sierra

Different multiline prompt behavior using zsh + oh-my-zsh + iTerm2 + High Sierra


On the latest macOS High Sierra, iTerm2, zsh, and oh-my-zsh, I've noticed that tab completion when using a multiline prompt is no longer flushing correctly. I've verified this issue on two separate machines and I'm wondering:

  1. if you can also verify this is an issue for you
  2. how to start zeroing in on which system is causing this issue
  3. if you know of a workaround

Example prompt:

PROMPT="$(virtualenv_info) %n at %~ on %M $(vcs_info)
%(!.#.$) "

Which produces:

(myvirtualenv) me at ~/source/some-repo on localhost [master]
$

Issue:

When attempting tab completion for commands like ls or cd, hitting TAB to see subdirectories causes the subsequent print to overwrite the lines containing the prompt:

(myvirtualenv) me at ~/source/some-repo on localhost [master]
$ ls some-f...

Hit TAB

(myvirtualenv) me at ~/source/some-repo on localhost [master]
$ ls some-folder/

Hit TAB again

  some-folder/
folder-1/    folder-2/    folder-3/

The above output overwrites the lines containing the prompt. I've tried setting locale info and different kinds of newlines. This multiline prompt still works correctly on an older version of zsh running on a CentOS AWS box I have, and tomorrow I can confirm whether it's still working on a < 10.13 macOS machine.


Solution

  • I was able to narrow this down by deduction to the COMPLETION_WAITING_DOTS setting, which I've now found corroborated in this oh-my-zsh issue. It appears this code behaves differently in High Sierra, so I'll look into that for a workaround or a possible fix. For now my workaround is removing my COMPLETION_WAITING_DOTS="true" setting.