about summary refs log tree commit diff
path: root/Test
diff options
context:
space:
mode:
Diffstat (limited to 'Test')
-rw-r--r--Test/comptest28
1 files changed, 18 insertions, 10 deletions
diff --git a/Test/comptest b/Test/comptest
index aae996105..7ea665c26 100644
--- a/Test/comptest
+++ b/Test/comptest
@@ -20,14 +20,16 @@ done
 
 input="$*"
 
-init=\
-'stty columns 80 rows 24
+tmp=/tmp/comptest.$$
+
+cat <<End >$tmp
+stty columns 80 rows 24
 LISTMAX=10000000
-'"ZLS_COLORS='no=<NO>:fi=<FI>:di=<DI>:ln=<LN>:pi=<PI>:so=<SO>:bd=<BD>:cd=<CD>:ex=<EX>:mi=<MI>:tc=<TC>:sp=<SP>:lc=<LC>:ec=<EC>\n:rc=<RC>'
+ZLS_COLORS='no=<NO>:fi=<FI>:di=<DI>:ln=<LN>:pi=<PI>:so=<SO>:bd=<BD>:cd=<CD>:ex=<EX>:mi=<MI>:tc=<TC>:sp=<SP>:lc=<LC>:ec=<EC>\n:rc=<RC>'
 bindkey -e
 autoload -U compinit
 compinit $dump
-"'zstyle ":completion:*" group-name ""
+zstyle ":completion:*" group-name ""
 zstyle ":completion*:messages" format "<MESSAGE>%d</MESSAGE>
 "
 zstyle ":completion*:descriptions" format "<DESCRIPTION>%d</DESCRIPTION>
@@ -39,7 +41,7 @@ zmodload zsh/complist
 expand-or-complete-with-report () {
   print -lr "<WIDGET><expand-or-complete>"
   zle expand-or-complete
-  print -lr - "<LBUFFER>$LBUFFER</LBUFFER>" "<RBUFFER>$RBUFFER</RBUFFER>"
+  print -lr - "<LBUFFER>\$LBUFFER</LBUFFER>" "<RBUFFER>\$RBUFFER</RBUFFER>"
   zle clear-screen
   zle -R
 }
@@ -59,19 +61,25 @@ zle -N finish
 bindkey "^I" expand-or-complete-with-report
 bindkey "^D" list-choices-with-report
 bindkey "^Z" finish
-'"$code"
+$code
+End
 
 export PS1="<PROMPT>"
 zpty zsh "$zsh" -f
 
 zpty -r zsh log "*<PROMPT>*"
 
-zpty -w zsh "eval ${init:q}"
+zpty -w zsh ". $tmp"
 zpty -r zsh log "*<PROMPT>*"
+rm $tmp
 
 zpty -w zsh "$input"$'\C-Z'
 zpty -r zsh log "*<WIDGET><finish>*"
 
+if [[ -n "$debug" ]]; then
+  print -lr - "$log" > /tmp/comptest.debug
+fi
+
 logs=(${(s:<WIDGET>:)log})
 shift logs
 
@@ -83,12 +91,12 @@ for log in "$logs[@]"; do
     log="${log[$mend[1]+1,-1]}"
     if (( 0 <= $mbegin[2] )); then
       if [[ $match[2] != TC && $match[3] != \ # ]]; then
-	print "$match[2]:{$match[3]}"
+	print -lr "$match[2]:{$match[3]}"
       fi
     elif (( 0 <= $mbegin[4] )); then
-      print "DESCRIPTION:{$match[4]}"
+      print -lr "DESCRIPTION:{$match[4]}"
     elif (( 0 <= $mbegin[5] )); then
-      print "MESSAGE:{$match[5]}"
+      print -lr "MESSAGE:{$match[5]}"
     fi
   done
 done