From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29854 invoked from network); 1 Mar 2000 13:12:12 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 1 Mar 2000 13:12:12 -0000 Received: (qmail 19366 invoked by alias); 1 Mar 2000 13:12:05 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 9952 Received: (qmail 19319 invoked from network); 1 Mar 2000 13:12:00 -0000 To: zsh-workers@sunsite.auc.dk Subject: Re: PATCH: completion tests References: <200003011144.MAA25867@beta.informatik.hu-berlin.de> MIME-Version: 1.0 (generated by AKEMI 1.13.2 - =?ISO-2022-JP?B?Ig==?= =?ISO-2022-JP?B?GyRCQTA0Y0s8GyhCIg==?=) Content-Type: text/plain; charset=US-ASCII From: Tanaka Akira Date: 01 Mar 2000 22:11:43 +0900 In-Reply-To: Sven Wischnowsky's message of "Wed, 1 Mar 2000 12:44:17 +0100 (MET)" Message-ID: User-Agent: Chao-gnus/6.12.5 AKEMI/1.13.2 (=?ISO-2022-JP?B?GyRCQTAbKEI=?= =?ISO-2022-JP?B?GyRCNGNLPBsoQg==?=) FLAM-DOODLE/1.12.6 (=?ISO-2022-JP?B?GyRCM3cbKEI=?= 10R4.0/5.0) Emacs/20.4 (sparc-sun-solaris2.6) MULE/4.0 (HANANOEN) In article <200003011144.MAA25867@beta.informatik.hu-berlin.de>, Sven Wischnowsky writes: > > Also, I couldn't extract display strings specified by compadd -d. Is > > there a simple way to extract? > > I'm not completely sure what you mean: a way to make those strings be > distinguishable in the output? I can't think of much either, maybe > something with list-colors, with a pattern like `* *', in the hope > that display strings normally contain a space while other matches > don't? Spaces are not problem. Actually comptest can handle filenames containing spaces. Z(2):akr@is27e1u11% touch 'A B' 'A C' Z(2):akr@is27e1u11% Src/zsh -f Test/comptest -D -z Src/zsh $'ls A\\ \t' line: {ls A\ }{} DESCRIPTION:{file} FI:{A\ \ C} FI:{A\ B} Z(2):akr@is27e1u11% bin2ascii /tmp/comptest.debug l\bls A\\ \r ls A\\ \r \r \x1B[H\x1B[2J\x1B[m\x1B[m\x1B[m\x1B[Jls A\\\x1B[K\x1B[1C\r\r file\x1B[K\r \x1B[K\r \x1B[JA\\ \\ C\r \r \r A\\ B\r \r \r \r \x1B[m\x1B[m\x1B[m\x1B[Jls A\\\x1B[K\x1B[1C\r \EOF It's because zsh delimits listed filenames by and . Of course, this will be problem with filenames containing etc. But it's not big problem because we can choose arbitrary long delimiters. The problem I wanted to mention in 9936 is that zsh doesn't delimit display strings properly as: Z(2):akr@is27e1u11% Src/zsh -f Test/comptest -D -z Src/zsh $'flex -\t' line: {flex -}{} DESCRIPTION:{option} NO:{-+ -- generate C++ scanner class} NO:{--version} Z(2):akr@is27e1u11% bin2ascii /tmp/comptest.debug|head f\bflex -\r flex -\r \r \x1B[H\x1B[2J\x1B[m\x1B[m\x1B[m\x1B[Jflex -\x1B[K\r\r option\x1B[K\r \x1B[K\r -+ -- generate C++ scanner class\x1B[K\r \r -7 -- generate 7-bit scanner\x1B[K\r \r Z(2):akr@is27e1u11% If `-7 -- generate 7-bit scanner' is delimited by and , we can extract the string. But there is no before the string and `\e[K' is inserted before . Following patch fixes comptest. * It didn't work on NetBSD. (pty/tty buffer size problem?) * Backslashes were unquoted by print. * Debug option didn't work. Index: Test/comptest =================================================================== RCS file: /projects/zsh/zsh/Test/comptest,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 comptest --- Test/comptest 2000/02/29 15:51:21 1.1.1.1 +++ Test/comptest 2000/03/01 13:00:21 @@ -20,14 +20,16 @@ input="$*" -init=\ -'stty columns 80 rows 24 +tmp=/tmp/comptest.$$ + +cat <$tmp +stty columns 80 rows 24 LISTMAX=10000000 -'"ZLS_COLORS='no=:fi=:di=:ln=:pi=:so=:bd=:cd=:ex=:mi=:tc=:sp=:lc=:ec=\n:rc=' +ZLS_COLORS='no=:fi=:di=:ln=:pi=:so=:bd=:cd=:ex=:mi=:tc=:sp=:lc=:ec=\n:rc=' bindkey -e autoload -U compinit compinit $dump -"'zstyle ":completion:*" group-name "" +zstyle ":completion:*" group-name "" zstyle ":completion*:messages" format "%d " zstyle ":completion*:descriptions" format "%d @@ -39,7 +41,7 @@ expand-or-complete-with-report () { print -lr "" zle expand-or-complete - print -lr - "$LBUFFER" "$RBUFFER" + print -lr - "\$LBUFFER" "\$RBUFFER" zle clear-screen zle -R } @@ -59,19 +61,25 @@ bindkey "^I" expand-or-complete-with-report bindkey "^D" list-choices-with-report bindkey "^Z" finish -'"$code" +$code +End export PS1="" zpty zsh "$zsh" -f zpty -r zsh log "**" -zpty -w zsh "eval ${init:q}" +zpty -w zsh ". $tmp" zpty -r zsh log "**" +rm $tmp zpty -w zsh "$input"$'\C-Z' zpty -r zsh log "**" +if [[ -n "$debug" ]]; then + print -lr - "$log" > /tmp/comptest.debug +fi + logs=(${(s::)log}) shift logs @@ -83,12 +91,12 @@ 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 -- Tanaka Akira