zsh-workers
 help / color / mirror / code / Atom feed
From: Oliver Kiddle <okiddle@yahoo.co.uk>
To: Zsh workers <zsh-workers@sunsite.dk>
Subject: PATCH: _prefix clearing the word
Date: Wed, 09 Jul 2003 17:41:38 +0200	[thread overview]
Message-ID: <21511.1057765298@gmcs3.local> (raw)

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
________________________________________________________________________


                 reply	other threads:[~2003-07-09 15:51 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=21511.1057765298@gmcs3.local \
    --to=okiddle@yahoo.co.uk \
    --cc=zsh-workers@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).