From 4ca0501c252714b520b5f959599c5149063a7aed Mon Sep 17 00:00:00 2001 From: Thiago de Arruda Date: Tue, 29 Oct 2013 08:26:59 -0300 Subject: [PATCH] Add magic prefix to distinguish completion lines from possible garbage output generated by the completion function --- completion-server-init.zsh | 2 +- completion-server.zsh | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/completion-server-init.zsh b/completion-server-init.zsh index 565fd45..4dec24c 100644 --- a/completion-server-init.zsh +++ b/completion-server-init.zsh @@ -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 diff --git a/completion-server.zsh b/completion-server.zsh index 4b19249..c9ac26a 100755 --- a/completion-server.zsh +++ b/completion-server.zsh @@ -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 }