zsh-workers
 help / color / mirror / code / Atom feed
* odd completion misbehavior?
@ 2011-10-20 20:48 Danek Duvall
  2011-10-20 21:44 ` Benjamin R. Haskell
  0 siblings, 1 reply; 2+ messages in thread
From: Danek Duvall @ 2011-10-20 20:48 UTC (permalink / raw)
  To: zsh-workers

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?

Thanks,
Danek


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: odd completion misbehavior?
  2011-10-20 20:48 odd completion misbehavior? Danek Duvall
@ 2011-10-20 21:44 ` Benjamin R. Haskell
  0 siblings, 0 replies; 2+ messages in thread
From: Benjamin R. Haskell @ 2011-10-20 21:44 UTC (permalink / raw)
  To: Danek Duvall, zsh-workers

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-10-20 21:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-20 20:48 odd completion misbehavior? Danek Duvall
2011-10-20 21:44 ` Benjamin R. Haskell

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).