zsh-workers
 help / color / mirror / code / Atom feed
From: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
To: zsh-workers@sunsite.dk
Subject: Re: bug in _describe
Date: Fri, 19 Oct 2001 12:25:13 +0200	[thread overview]
Message-ID: <15311.65417.5840.933884@gargle.gargle.HOWL> (raw)
In-Reply-To: <3BCDCEF1.C103658D@yahoo.co.uk>


Oliver Kiddle wrote:

> Completion of conditions no longer works:
> 
> % [[ -<tab>
> (eval):1: error in flags
> 
> I'm fairly certain that this was introduced in 15415. Error comes from
> line 57 of _describe. It is not accounting for arrays specified as '(
> ... )' instead of actual array names.

Ahem. Indeed. I forgot to handle the case where the matches are given
with `(...)', not via an array name. Sorry.

The patch also makes _condition use _file_descriptors for completion
after -t and it keeps _file_descriptors from displaying empty
descriptions.

Bye
  Sven

Index: Completion/Base/Utility/_describe
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Base/Utility/_describe,v
retrieving revision 1.9
diff -u -r1.9 _describe
--- Completion/Base/Utility/_describe	2001/08/07 10:38:36	1.9
+++ Completion/Base/Utility/_describe	2001/10/19 10:24:45
@@ -54,7 +54,11 @@
       while (( $# )); do
     
         _strs="_a_$_try$_i"
-        eval local "_a_$_try$_i;_a_$_try$_i"'=( "${'$1'[@]}" )'
+        if [[ "$1" = \(*\) ]]; then
+          eval local "_a_$_try$_i;_a_$_try$_i"'='$1
+        else
+          eval local "_a_$_try$_i;_a_$_try$_i"'=( "${'$1'[@]}" )'
+        fi
         _argv[_i]="_a_$_try$_i"
         shift
         (( _i++ ))
@@ -63,7 +67,11 @@
           _mats=
         else
           _matss="_a_$_try$_i"
-          eval local "_a_$_try$_i;_a_$_try$_i"'=( "${'$1'[@]}" )'
+          if [[ "$1" = \(*\) ]]; then
+            eval local "_a_$_try$_i;_a_$_try$_i"'='$1
+          else
+            eval local "_a_$_try$_i;_a_$_try$_i"'=( "${'$1'[@]}" )'
+          fi
           _argv[_i]="_a_$_try$_i"
           shift
           (( _i++ ))
Index: Completion/Zsh/Context/_condition
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Zsh/Context/_condition,v
retrieving revision 1.1
diff -u -r1.1 _condition
--- Completion/Zsh/Context/_condition	2001/04/02 11:22:21	1.1
+++ Completion/Zsh/Context/_condition	2001/10/19 10:24:45
@@ -6,6 +6,8 @@
   _tags -C -o options && _options
 elif [[ "$prev" = -([a-hkprsuwxLOGSN]|[no]t|ef) ]]; then
   _tags -C "$prev" files && _files
+elif [[ "$prev" = -t ]]; then
+  _file_descriptors
 else
   if [[ "$PREFIX" = -* ]] ||
      ! zstyle -T ":completion:${curcontext}:options" prefix-needed; then
Index: Completion/Zsh/Type/_file_descriptors
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Zsh/Type/_file_descriptors,v
retrieving revision 1.2
diff -u -r1.2 _file_descriptors
--- Completion/Zsh/Type/_file_descriptors	2001/07/25 12:36:34	1.2
+++ Completion/Zsh/Type/_file_descriptors	2001/10/19 10:24:45
@@ -19,7 +19,11 @@
       list=( ${list[@]} "$i $sep $(ls -l /proc/$$/fd/$i|sed 's/.*-> //' )" )
     done
   fi
-  _wanted file-descriptors expl 'file descriptors' compadd "$@" -d list -a fds
-else
-  _wanted file-descriptors expl 'file descriptors' compadd "$@" -a fds
+
+  if (( $list[(I)* $sep ?*] )); then
+    _wanted file-descriptors expl 'file descriptors' compadd "$@" -d list -a fds
+    return
+  fi
 fi
+
+_wanted file-descriptors expl 'file descriptors' compadd "$@" -a fds

-- 
Sven Wischnowsky                    wischnow@informatik.hu-berlin.de


      reply	other threads:[~2001-10-19 10:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-10-17 18:33 Oliver Kiddle
2001-10-19 10:25 ` Sven Wischnowsky [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=15311.65417.5840.933884@gargle.gargle.HOWL \
    --to=wischnow@informatik.hu-berlin.de \
    --cc=zsh-workers@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).