Add magic prefix to distinguish completion lines

from possible garbage output generated by the completion function
This commit is contained in:
Thiago de Arruda 2013-10-29 08:26:59 -03:00
parent 3734b1eb4e
commit 4ca0501c25
2 changed files with 3 additions and 2 deletions

View File

@ -110,7 +110,7 @@ compadd () {
# description to be displayed afterwards
# (( $#__dscr >= $i )) && dscr=" -- ${${__dscr[$i]}##$__hits[$i] #}" || dscr=
print - $IPREFIX$apre$hpre$__hits[$i]$dsuf$hsuf$asuf$dscr
print - $'\1'$IPREFIX$apre$hpre$__hits[$i]$dsuf$hsuf$asuf$dscr
done

View File

@ -19,7 +19,8 @@ zpty -w z "source '${0:a:h}/completion-server-init.zsh'"
read-to-null() {
while zpty -r z chunk; do
[[ $chunk == *$'\0'* ]] && break
print -n - $chunk
[[ $chunk != $'\1'* ]] && continue # ignore what doesnt start with '1'
print -n - ${chunk:1}
done
}