zsh-users
 help / color / mirror / code / Atom feed
From: Oliver Kiddle <opk@zsh.org>
To: Marlon Richert <marlon.richert@gmail.com>
Cc: Zsh Users <zsh-users@zsh.org>
Subject: Re: Completion: How to show description for current option?
Date: Thu, 02 Sep 2021 22:08:58 +0200	[thread overview]
Message-ID: <39387-1630613338.989690@_LKB.nzf7.4sbx> (raw)
In-Reply-To: <CAHLkEDtFKQcbOAiABdO5ges98hByAnuhtqNVPPxZYNoJ8gH8Xw@mail.gmail.com>

On 31 Aug, Marlon Richert wrote:
> If I type
>
> % git switch -c^D
>
> then completion shows only
> -c

This can be reproduced with just _arguments -s '-c[desc]'

The code relevant to this is this part of _arguments:

    346       if comparguments -O next direct odirect equal; then
    347         opts=yes
    348         _tags options
    349       elif [[ $? -eq 2 ]]; then
    350           compadd -Q - "${PREFIX}${SUFFIX}"
    351           return 0

The comparguments -O has decided that there are no possible completion
matches which is arguably true because -c is already there and, because
we passed -s to _arguments, it is now trying to complete further options
after -c. It looks like there is special handling for this case that has
only considered actual completion because it is doing a plain compadd
without descriptions.

A similar case would be _arguments -s '-c[desc]' -d
and -dc^D
That prints 'no arguments'

A fix would need to be done within the C code for comparguments -O and
it'd probably be hard to do without breaking it more than fixing it.

Oliver


  parent reply	other threads:[~2021-09-02 20:28 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-31 11:03 Marlon Richert
2021-08-31 11:11 ` Roman Perepelitsa
2021-08-31 17:22   ` Bart Schaefer
2021-08-31 17:39     ` Roman Perepelitsa
2021-09-01  0:23     ` Bart Schaefer
2021-09-01 11:27       ` Marlon Richert
2021-09-02 20:08 ` Oliver Kiddle [this message]
2021-09-02 20:41   ` Bart Schaefer

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=39387-1630613338.989690@_LKB.nzf7.4sbx \
    --to=opk@zsh.org \
    --cc=marlon.richert@gmail.com \
    --cc=zsh-users@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).