* PATCH: _prefix clearing the word
@ 2003-07-09 15:41 Oliver Kiddle
0 siblings, 0 replies; only message in thread
From: Oliver Kiddle @ 2003-07-09 15:41 UTC (permalink / raw)
To: Zsh workers
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
________________________________________________________________________
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2003-07-09 15:51 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-07-09 15:41 PATCH: _prefix clearing the word Oliver Kiddle
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).