Steps to reproduce:
Resize the terminal to width 80 or less, making it easier for prompt to wrap.
/etc/zshrcin case it affects outcome. (Remember to change it back afterwards!)
Create a really deep folder, like
mkdir -p /tmp/very-deep/directory/very-deep/directory/very-deep/directory/very-deep/directory/very-deep/directory
Run a clean Zsh with
/usr/bin/env -i ZDOTDIR=/tmp TERM=xterm-256color /bin/zsh
Set prompt with
Change directory to that folder. The prompt should wrap.
Try auto-complete. For example, type
dirthen hit Tab key.
On my machine, after the last step the
dir was moved one character left. There was a space between prompt and command before I trigger the completion, which was eliminated by
dir moving left. In other words, before I hit Tab the line ends with
directory dir, but completion makes it
directorydir. This behavior was similar to Bash not properly wrapping ANSI escape code with
\], except that in this case there should be no ANSI escape code in prompt.
I tried eliminating all possible variables, including environment variable, configuration files, terminal emulator. What else can possibly go wrong?
In case it matters, I’m using Catalina.