From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10475 invoked from network); 7 Feb 1997 11:25:29 -0000 Received: from euclid.skiles.gatech.edu (list@130.207.146.50) by coral.primenet.com.au with SMTP; 7 Feb 1997 11:25:29 -0000 Received: (from list@localhost) by euclid.skiles.gatech.edu (8.7.3/8.7.3) id GAA03523; Fri, 7 Feb 1997 06:14:59 -0500 (EST) Resent-Date: Fri, 7 Feb 1997 06:14:59 -0500 (EST) Message-Id: <199702071116.MAA12975@hydra.ifh.de> To: zsh-workers@math.gatech.edu (Zsh hackers list) Subject: completion fix Date: Fri, 07 Feb 1997 12:16:49 +0100 From: Peter Stephenson Resent-Message-ID: <"B25mA3.0.-s.pwm-o"@euclid> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/2881 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu A couple of tests in do_single() looks for menucur (the current menu completion entry) being set instead of menucmp (the flag for menu completion), which seems to be necessary since the new completion may be a menu completion even though no previous menu completion needs to be removed. The problem is menucur is not automatically reset, so that causes the types of problem listed below. The patch fixes it by setting menucur to zero when the list is invalidated; I can't see how this can be wrong, since if the list is invalid menucur is pointing at garbage (it points into amatches which has just been freed). % zsh -f % mkdir foi foi/bar foo % setopt menucomplete # I see some kind soul has decided it's unnecessary to have a # pre-defined completion for setopt, probably saving less space than # it takes the average user to define it in .zshrc, so I have to # type it out by hand. Thanks. (That's not the bug.) % echo fo foi foo % echo foi/ # ^ cursor here. To see what's in foi with ^D, we need to stop # menucompletion, so I type `!'; line remains the same. # (Actually, I have some binding to do it for me, but it doesn't matter.) % echo foi/^D bar/ # So far so good. Now I want to complete in foi/, so I type % echo fobar/ Ooops. The completion code thinks it still has a menu entry to delete when it inserts the new `bar'. *** Src/Zle/zle_tricky.c.il Wed Feb 5 09:31:35 1997 --- Src/Zle/zle_tricky.c Fri Feb 7 11:22:40 1997 *************** *** 2973,2978 **** --- 2973,2979 ---- freecompctl(ccmain); } lastambig = menucmp = showinglist = validlist = 0; + menucur = NULL; } /* Get the words from a variable or a compctl -k list. */ -- Peter Stephenson Tel: +49 33762 77366 WWW: http://www.ifh.de/~pws/ Fax: +49 33762 77413 Deutsches Elektronen-Synchrotron --- Institut fuer Hochenergiephysik Zeuthen DESY-IfH, 15735 Zeuthen, Germany.