Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: _prefix clearing the word
- X-seq: zsh-workers 18841
- From: Oliver Kiddle <okiddle@xxxxxxxxxxx>
- To: Zsh workers <zsh-workers@xxxxxxxxxx>
- Subject: PATCH: _prefix clearing the word
- Date: Wed, 09 Jul 2003 17:41:38 +0200
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
zstyle ':completion:*' completer _complete _prefix
cd /usr/lo<tab>oc
and the whole word disappears.
This problem relates back to the change in 15357. That change was a
fairly nasty hack: to prevent the cursor going to the end of the suffix
if there is one match a second match is added which is the same as
the first (${compstate[unambiguous]}) with the suffix chopped off and an
`x' added. This results in an ambiguous completion so the cursor doesn't
advance past the suffix.
Now in this particular case, it gets an ambiguous completion where the
common part is nothing. I have no idea why but it probably has something
to do with the first match being added with some special case stuff
(compadd -Qf -p /usr/ -W /usr/).
Best I can think of is the patch below. If adding the second match
results in ${compstate[unambiguous]} being empty then insert the first
match. Seems to work quite well but I wouldn't be suprised if we need to
patch more things onto the side of this.
By the way, the bug mentioned in 17846 is still an issue. Not really related
to _prefix but it was through that that I was reminded.
Oliver
Index: Completion/Base/Completer/_prefix
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Base/Completer/_prefix,v
retrieving revision 1.2
diff -u -r1.2 _prefix
--- Completion/Base/Completer/_prefix 10 Jul 2001 09:25:43 -0000 1.2
+++ Completion/Base/Completer/_prefix 9 Jul 2003 15:23:59 -0000
@@ -48,7 +48,11 @@
[[ compstate[nmatches] -gt 1 ]] && return 0
compadd -U -i "$IPREFIX" -I "$ISUFFIX" - "${compstate[unambiguous]%$suf}x"
compstate[list]=
- compstate[insert]=unambiguous
+ if [[ -n $compstate[unambiguous] ]]; then
+ compstate[insert]=unambiguous
+ else
+ compstate[insert]=0
+ fi
return 0
fi
(( _matcher_num++ ))
________________________________________________________________________
This email has been scanned for all viruses by the MessageLabs Email
Security System. For more information on a proactive email security
service working around the clock, around the globe, visit
http://www.messagelabs.com
________________________________________________________________________
Messages sorted by:
Reverse Date,
Date,
Thread,
Author