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

Re: Completion after zle doesn't work



On Feb 27,  5:13pm, Peter Stephenson wrote:
} Subject: Completion after zle doesn't work
}
} hangs until I type ^C.  Unfortunately ^X? does something even more
} disastrous (seems to mess up the tty), but I did get a 1/2 MB output

The zle completion bug was introduced by Oliver in 16464.  There's an
infinite loop in _zle:

while (( $#state )); do
    # ...
    (widget*)
      _wanted -C "$context[1]" widgets expl widget compadd -k widgets && ret=0
      [[ $st != *function ]] && continue
      ;&                      # ^^^^^^^^ Ooops!
    (function)
      _wanted -C "$context[1]" functions expl 'widget shell function' \
	compadd -k functions && ret=0
      ;;
    # ...
esac

16464 removed `local st' but this code is still testing it and looping.

I'm not sure exactly what's going on with ^X? there -- it appears that
the interrupt is not being handled correctly; you can break out of the
loop only when not doing _complete_debug.

Anyway, here's the minimalist patch for _zle, but I'm not sure that it
couldn't be done more cleanly some other way.


Index: _zle
===================================================================
RCS file: /extra/cvsroot/zsh/zsh-4.0/Completion/Zsh/Command/_zle,v
retrieving revision 1.2
diff -c -r1.2 _zle
--- _zle	2002/02/04 19:48:20	1.2
+++ _zle	2002/03/01 05:03:51
@@ -46,9 +46,9 @@
       ;;
     (widget*)
       _wanted -C "$context[1]" widgets expl widget compadd -k widgets && ret=0
-      [[ $st != *function ]] && continue
       ;&
     (function)
+      [[ $state[1] != *function ]] ||	# Handle fall-through
       _wanted -C "$context[1]" functions expl 'widget shell function' \
 	compadd -k functions && ret=0
       ;;


-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   



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