From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23001 invoked from network); 2 Nov 1998 09:37:49 -0000 Received: from math.gatech.edu (list@130.207.146.50) by ns1.primenet.com.au with SMTP; 2 Nov 1998 09:37:49 -0000 Received: (from list@localhost) by math.gatech.edu (8.9.1/8.9.1) id EAA09786; Mon, 2 Nov 1998 04:31:07 -0500 (EST) Resent-Date: Mon, 2 Nov 1998 04:31:07 -0500 (EST) From: "Bart Schaefer" Message-Id: <981102012927.ZM6545@candle.brasslantern.com> Date: Mon, 2 Nov 1998 01:29:27 -0800 X-Mailer: Z-Mail (4.0b.820 20aug96) To: zsh-workers@math.gatech.edu Subject: BUG: Extended completion with alternative completion MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Resent-Message-ID: <"n-Ljj2.0.oO2.RlNFs"@math> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/4492 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu I'm fooling with the compctl for cdmatch from Misc/compctl-examples: compctl -K cdmatch -S '/' -q -x 'p[2]' -Q -K cdmatch2 - \ 'S[/][~][./][../]' -g '*(-/)' + -g '*(-/D)' - \ 'n[-1,/]' -K cdmatch -S '/' -q -- cd chdir pushd With this compctl installed (and no others except the 3.1.5 defaults, which are essentially none), from the zsh-3.1.5 directory, the following setopts: noautomenu off completealiases off completeinword on <-- This is important globcomplete off menucomplete off I type: zagzig<7> cd S/M Now back up so the cursor is on the `S' and press TAB. The n[-1,/] case is chosen correctly by get_ccompctl() and returned to makecomplist(). At this point we hit the following code: /* *compadd is the number of characters we have to ignore at the * * beginning of the word. */ wb += *compadd; s += *compadd; if ((offs -= *compadd) < 0) /* It's bigger than our word prefix, so we can't help here... */ return 1; offs <= *compadd, so 1 is returned to docompletion() at this code: /* Make sure we have the completion list and compctl. */ if(makecomplist(s, incmd, &delit, &compadd, untokenized)) { /* Error condition: feeeeeeeeeeeeep(). */ feep(); goto compend; } At this point we feep() and fail, mistakenly believing that an error has occurred. This appears harmless until the compctl is modified like so: compctl -K cdmatch -S '/' -q -x 'p[2]' -Q -K cdmatch2 - \ 'S[/][~][./][../]' -g '*(-/)' + -g '*(-/D)' - \ 'n[-1,/]' -K cdmatch -S '/' -q -- + -K cdmatch -S '/' -q \ cd chdir pushd ^^^^^^^^^^^^^^^^^^^^^^^ There are two problems: (1) in get_ccompctl(), when we chose to return the n[] completion, we lose track of the alternative (which hangs off the xor pointer in the head of the linked list of -x patterns); (2) we're prematurely returning an error in makecomplist(), so even if we still had the handle to the xor, we'd never follow it. In short, alternative completion only works with extended completion when none of the extended patterns match, which doesn't seem right to me. It's not hard to fix (2), but I'm leery of messing with (1) when there are a lot of other pending completion patches to be folded in to 3.1.6. Sven, are you out there? -- Bart Schaefer Brass Lantern Enterprises http://www.well.com/user/barts http://www.brasslantern.com