zsh-workers
 help / color / mirror / code / Atom feed
* bug in _describe
@ 2001-10-17 18:33 Oliver Kiddle
  2001-10-19 10:25 ` Sven Wischnowsky
  0 siblings, 1 reply; 2+ messages in thread
From: Oliver Kiddle @ 2001-10-17 18:33 UTC (permalink / raw)
  To: zsh-workers

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.

Oliver


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: bug in _describe
  2001-10-17 18:33 bug in _describe Oliver Kiddle
@ 2001-10-19 10:25 ` Sven Wischnowsky
  0 siblings, 0 replies; 2+ messages in thread
From: Sven Wischnowsky @ 2001-10-19 10:25 UTC (permalink / raw)
  To: zsh-workers


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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2001-10-19 10:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-10-17 18:33 bug in _describe Oliver Kiddle
2001-10-19 10:25 ` Sven Wischnowsky

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).