zsh-workers
 help / color / mirror / code / Atom feed
From: "Benjamin R. Haskell" <zsh@benizi.com>
To: Danek Duvall <duvall@comfychair.org>, zsh-workers@zsh.org
Subject: Re: odd completion misbehavior?
Date: Thu, 20 Oct 2011 17:44:56 -0400 (EDT)	[thread overview]
Message-ID: <alpine.LNX.2.01.1110201727380.10807@hp.internal> (raw)
In-Reply-To: <20111020204800.GA28174@lorien.comfychair.org>

On Thu, 20 Oct 2011, Danek Duvall wrote:

> With the following completion function:
>
> 	_danek() {
> 		_arguments \
> 			"--zoo-name" \
> 			"--zipple-zoo-name"
> 	}
>
> and running under zsh -f with only
>
>    autoload -Uz compinit
>    compinit -i
>    compdef _danek danek
>
> if I type "danek --z<TAB>", I end up with "danek --z-name", with the 
> cursor on the dash between "z" and "name".  If I hit tab again, I end 
> up with "danek --zoo-name ", with the cursor after the final space. 
> If I setopt menucomplete, I get reasonable behavior.
>
> What have I done wrong with the completion function?

(Everywhere below, I'm marking the cursor position with '|')

Nothing.  Zsh is completing the entirety of the unambiguous portions. 
All of the possible completions in that context:

'--zoo-name' and '--zipple-zoo-name'

begin with: '--z'
and end with: '-name'

So, zsh completes as much as possible.

I'm also interested in a way to disable this behavior, but looking at 
all of the instances of 'suffix' and 'ambiguous' in anything remotely 
completion-related in zshall didn't turn up what style to set/unset (if 
such a style exists).

In my case, the place this bothers me is with _mysql and the 
--default-character-set, --defaults-file, and --defaults-extra-file 
settings:

mysql --def|<Tab>
mysql --default|-               # makes sense
mysql --defaults|<Tab>-         # add the 's'
mysql --defaults|<Tab>-file     # okay, now everything starts w/ '--defaults' and ends w/ '-file'
mysql --defaults-file=|         # but, tab again gets me --defaults-file, even though it was still ambiguous with --defaults-extra-file

Might be some way in which my styles are set up (accept-exact 
somewhere?).  But, I'm still getting my feet wet with zstyle.

-- 
Best,
Ben


      reply	other threads:[~2011-10-20 21:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-20 20:48 Danek Duvall
2011-10-20 21:44 ` Benjamin R. Haskell [this message]

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=alpine.LNX.2.01.1110201727380.10807@hp.internal \
    --to=zsh@benizi.com \
    --cc=duvall@comfychair.org \
    --cc=zsh-workers@zsh.org \
    /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).