* Issue with insert-sections style
@ 2010-09-09 14:50 Julius Plenz
2010-09-09 16:34 ` Bart Schaefer
2010-09-09 18:04 ` Greg Klanderman
0 siblings, 2 replies; 5+ messages in thread
From: Julius Plenz @ 2010-09-09 14:50 UTC (permalink / raw)
To: zsh-workers
Hi there,
I discovered an issue with the insert-sections style for manual
pages (which, by the way, is not documented anywhere).
If you use the _oldlist completer together with the no_list_ambiguous
option the following bug occurs: When you have entered a man page name
with a prefix that can only be expanded to man pages from one section,
that section number gets inserted when drawing the listing, and then
*again* when the user enters menu completion.
Provided below is a minimal zshrc to reproduce the bug. An example
which will work on most systems might be "man pam_li<Tab><Tab>":
# minimal setup
autoload -U compinit && compinit
zmodload -i zsh/complist
bindkey '^i' complete-word
zstyle ':completion:*' menu select # if you like
zstyle ':completion:*' group-name ''
zstyle ':completion:*:descriptions' format 'completing %B%d%b'
zstyle ':completion:*:manuals' separate-sections true
# make insertion possible
setopt extendedglob
zstyle ':completion:*:manuals.(^1*)' insert-sections true
# cause double-insertion
zstyle ':completion:*' completer _oldlist _complete
setopt nolistambiguous
Cheers,
Julius
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Issue with insert-sections style
2010-09-09 14:50 Issue with insert-sections style Julius Plenz
@ 2010-09-09 16:34 ` Bart Schaefer
2010-09-09 18:04 ` Greg Klanderman
1 sibling, 0 replies; 5+ messages in thread
From: Bart Schaefer @ 2010-09-09 16:34 UTC (permalink / raw)
To: zsh-workers
On Sep 9, 4:50pm, Julius Plenz wrote:
}
} If you use the _oldlist completer together with the no_list_ambiguous
} option the following bug occurs: When you have entered a man page name
} with a prefix that can only be expanded to man pages from one section,
} that section number gets inserted when drawing the listing, and then
} *again* when the user enters menu completion.
The trouble here is that the section number *and a trailing space* are
passed to compadd as a prefix of the manual page name to be completed.
On the subsequent TAB, that trailing space causes the section number
on the line to be treated as a different word, and therefore it is not
matched against the entries in the previously-generated completion list
when it is re-used by _oldlist.
This is a generic limitation of completion: it does not operates across
$IFS-delimited boundaries, so any ambiguous match that includes an un-
quoted $IFS character can produce confusion when completion is repeated
on one of the substrings of the match.
It might be possible to partly fix this in _oldlist by, e.g., testing
for ${#${(z)_lastcomp[unambiguous]}} > 1 and discarding the old list in
that case. (Can't use that test directly because if ${(z)...} yeilds
only one word, ${#...} counts the number of characters, but you get the
idea.)
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Issue with insert-sections style
2010-09-09 14:50 Issue with insert-sections style Julius Plenz
2010-09-09 16:34 ` Bart Schaefer
@ 2010-09-09 18:04 ` Greg Klanderman
2010-09-09 19:00 ` Peter Stephenson
1 sibling, 1 reply; 5+ messages in thread
From: Greg Klanderman @ 2010-09-09 18:04 UTC (permalink / raw)
To: zsh-workers
>>>>> On September 9, 2010 Julius Plenz <julius@plenz.com> wrote:
> zstyle ':completion:*' group-name ''
> zstyle ':completion:*:descriptions' format 'completing %B%d%b'
> zstyle ':completion:*:manuals' separate-sections true
As an aside, can someone help me with the right zstyle syntax to have
the first two lines above apply only to man page completions?
thanks,
Greg
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Issue with insert-sections style
2010-09-09 18:04 ` Greg Klanderman
@ 2010-09-09 19:00 ` Peter Stephenson
2010-09-10 13:50 ` Greg Klanderman
0 siblings, 1 reply; 5+ messages in thread
From: Peter Stephenson @ 2010-09-09 19:00 UTC (permalink / raw)
Cc: zsh-workers
On Thu, 09 Sep 2010 14:04:13 -0400
Greg Klanderman <greg@klanderman.net> wrote:
> >>>>> On September 9, 2010 Julius Plenz <julius@plenz.com> wrote:
>
> > zstyle ':completion:*' group-name ''
> > zstyle ':completion:*:descriptions' format 'completing %B%d%b'
> > zstyle ':completion:*:manuals' separate-sections true
>
> As an aside, can someone help me with the right zstyle syntax to have
> the first two lines above apply only to man page completions?
What you're supposed to do is use ^Xh in the context where you want the
style to apply and work it out from that. The tag would be after the
last colon shown. I think using the command name and tag would be good
enough, :completion:*:*:man:*:manuals. There are some limitations on
whether some styles are looked up with the tag, in which case you're out
of luck with making it specific to manual pages, but you should still be
able to use the command, :completion:*:*:man:*:*.
--
Peter Stephenson <p.w.stephenson@ntlworld.com>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Issue with insert-sections style
2010-09-09 19:00 ` Peter Stephenson
@ 2010-09-10 13:50 ` Greg Klanderman
0 siblings, 0 replies; 5+ messages in thread
From: Greg Klanderman @ 2010-09-10 13:50 UTC (permalink / raw)
To: zsh-workers
Thanks Peter, this seems to work:
| zstyle ':completion:*:manuals' separate-sections true
| zstyle ':completion:*:manuals*' group-name ''
| zstyle ':completion:*:manuals*' format '%B%d completions:%b'
it took a little tracing of the completion system into _descriptions
to realize 'manuals.$sect' is a tag, not an argument value, and so
trying to do
| zstyle ':completion:*:manuals*:descriptions' format '%B%d completions:%b'
can't work. And the description of the 'format' style in the manual
now makes a lot more sense.. :-)
thanks,
Greg
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2010-09-10 13:59 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-09-09 14:50 Issue with insert-sections style Julius Plenz
2010-09-09 16:34 ` Bart Schaefer
2010-09-09 18:04 ` Greg Klanderman
2010-09-09 19:00 ` Peter Stephenson
2010-09-10 13:50 ` Greg Klanderman
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).