PENTESTING-BIBLE icon indicating copy to clipboard operation
PENTESTING-BIBLE copied to clipboard

zsh tab completion messes up terminal

Open SkyperTHC opened this issue 1 year ago • 0 comments

Tested on MacOS/Cygwin/Linux.

Using the default two line prompt with the skull-emoji. Problem is that zsh counts the length of the prompt for tab completion and the UTF characters mess with that counting. All UTF characters need to be wrapped in %{%G<UTC character%}.

How to reproduce:

docker run --rm  -it kalilinux/kali-rolling
apt update -y
apt install -y --no-install-recommends zsh
zsh -il

echo<TAB><TAB>

(e.g. write echo and then press TAB twice and observe how the prompt will get messed up.)

This fixes it (note the two UTF8 characters following the 'n'):

sed -i 's/\(\s*PROMPT=.*\)n└─\(.*\)/\1n%{%G└%}%{%G─%}\2/g' ~/.zshrc

I think this is actually a ZSH problem because people all over the Internet are crying that zsh tab completion messes up their prompt if they use emojis in their prompt (?).

SkyperTHC avatar Jul 31 '22 21:07 SkyperTHC