zsh-workers
 help / color / mirror / code / Atom feed
From: "Jun T." <takimoto-j@kba.biglobe.ne.jp>
To: zsh-workers@zsh.org
Subject: Re: A weird bug of grep completion
Date: Thu, 2 Aug 2018 23:09:55 +0900	[thread overview]
Message-ID: <9B106BAB-CA6A-454E-AE77-A9F8FC2A4779@kba.biglobe.ne.jp> (raw)
In-Reply-To: <15e31c7e-4fc4-401a-8320-184f3914e572@Spark>


> 2018/07/28 11:28, Joseph Lee <cgjosephlee@gmail.com> wrote:
> 
> A weird behavior happened when completing `grep --no-*` arguments.
> While typing `--no-group-separator`, which is a GNU only argument, after another `--no-*`, the cursor stoped in a wrong place and unable to finish completion. But it works right when `--no-group-separator` goes ahead.

The problem can be reproduced by simple examples shown below,
but I don't know how to fix it.

% compdef '_arguments : -a-a -a-b -a-c -a-d-e' cmd

Then the following work as expected
('<TAB>' can be replaced by '-<TAB>' or '-a-<TAB>' etc.)
% cmd <TAB>
% cmd -a-a <TAB>
% cmd -a-a -a-b -a-c <TAB>
% cmd -a-a -a-d-e <TAB>

But this does not work
% cmd -a-a -a-b <TAB>

So the problem occurs when
  exactly two possibilities are remaining for completion
    and
  one of the possibilities contains two (or more) hyphens
  (as in a-d-e) except for the leading '-'.

# If -a-d-e is replaced by -a-d-c then behavior changes
# (becomes worse, I think).

The problem is related with the match-spec "r:|[_-]=*" used
by _arguments (hard-coded in parse_cadef(), computil.c).
For example, the following does not work either:

% compdef 'compadd -M "r:|[_-]=*" a-a a-b-a' cmd
% cmd <TAB>

But I couldn't get exactly why this happens or how to
fix this.

  parent reply	other threads:[~2018-08-02 14:10 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-28  2:28 Joseph Lee
2018-07-28  2:34 ` Joey Pabalinas
2018-07-28  7:54   ` Daniel Shahaf
2018-07-30  3:39     ` Joseph Lee
2018-08-02 14:09 ` Jun T. [this message]
2018-08-16  8:20   ` Jun T
2018-08-16  9:02     ` Peter Stephenson

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=9B106BAB-CA6A-454E-AE77-A9F8FC2A4779@kba.biglobe.ne.jp \
    --to=takimoto-j@kba.biglobe.ne.jp \
    --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).