Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

_zle prints _zle:shift:69: shift count must be <= $#



This seems to be because of
http://www.zsh.org/cgi-bin/mla/redirect?WORKERNUMBER=16464
The while loop over $state only ever runs once, because _arguments
unsets it. The function appears to work fine with the loop removed (at
least as well as it did with it).

diff --git a/Completion/Zsh/Command/_zle b/Completion/Zsh/Command/_zle
index a1fe136..80f2177 100644
--- a/Completion/Zsh/Command/_zle
+++ b/Completion/Zsh/Command/_zle
@@ -36,38 +36,34 @@ _arguments -s -S \
     "(-L)-a[list all widgets]" \
     '*:widget name:->widget' && ret=0

-while (( $#state )); do
-  case "$state[1]" in
-    (args)
-      _arguments \
-        '(-N)-n[numeric prefix]:number:' \
-	'(-n)-N[reset numeric prefix]' \
-	'(-)*:widget arguments: ' && ret=0
-      ;;
-    (widget*)
-      _wanted -C "$context[1]" widgets expl widget compadd -k widgets && ret=0
-      ;&
-    (function)
-      [[ $state[1] != *function ]] ||	# Handle fall-through
-      _wanted -C "$context[1]" functions expl 'widget shell function' \
-	compadd -k functions && ret=0
-      ;;
-    (comp-widget)
-      _wanted -C "$context[1]" widgets expl 'completion widget' \
-	compadd -k "widgets[(R)(*:|)(.|)(${(j(|))compwids})(|:*)]" && ret=0
-      ;&
-    (builtin-comp-widget)
-      _wanted -C "$context[1]" widgets expl 'builtin completion widget' \
-	compadd -k "widgets[(I)(.|)(${(j(|))compwids})]" && ret=0
-      ;;
-    (redisplay)
-      _arguments -s -S '!-R' \
-	"-c[clear listing]" \
-	":status line" "*:strings to list" && ret=0
-      ;;
-  esac
-  shift 1 state
-  shift 1 context
-done
+case "$state[1]" in
+  (args)
+    _arguments \
+      '(-N)-n[numeric prefix]:number:' \
+      '(-n)-N[reset numeric prefix]' \
+      '(-)*:widget arguments: ' && ret=0
+    ;;
+  (widget*)
+    _wanted -C "$context[1]" widgets expl widget compadd -k widgets && ret=0
+    ;&
+  (function)
+    [[ $state[1] != *function ]] ||	# Handle fall-through
+    _wanted -C "$context[1]" functions expl 'widget shell function' \
+      compadd -k functions && ret=0
+    ;;
+  (comp-widget)
+    _wanted -C "$context[1]" widgets expl 'completion widget' \
+      compadd -k "widgets[(R)(*:|)(.|)(${(j(|))compwids})(|:*)]" && ret=0
+    ;&
+  (builtin-comp-widget)
+    _wanted -C "$context[1]" widgets expl 'builtin completion widget' \
+      compadd -k "widgets[(I)(.|)(${(j(|))compwids})]" && ret=0
+    ;;
+  (redisplay)
+    _arguments -s -S '!-R' \
+      "-c[clear listing]" \
+      ":status line" "*:strings to list" && ret=0
+    ;;
+esac

 return ret


http://git.mika.l3ib.org/?p=zsh-cvs.git;a=patch;h=8f73ed88fa5c259c4d996987f1f023ec5f60f278

-- 
Mikael Magnusson



Messages sorted by: Reverse Date, Date, Thread, Author