zsh-workers
 help / color / mirror / code / Atom feed
From: Oliver Kiddle <okiddle@yahoo.co.uk>
To: dana <dana@dana.is>
Cc: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: [BUG] Issue with _arguments !-x !+x
Date: Sun, 01 Mar 2020 22:36:55 +0100	[thread overview]
Message-ID: <73158-1583098615.557435@POT1.7-E-.0MVN> (raw)
In-Reply-To: <BED65A01-95AA-473E-BCF8-3E5E19A66C7E@dana.is>

On 12 Feb, dana wrote:
> I noticed something unexpected when i have both !-x and !+x type option specs
> and then i try to complete stacked options containing the -x ones:

> All i can figure out so far is that comparguments doesn't think there's
> anything to complete. But i'm not sure why. Something to do with how ca_doff
> is calculated, i think?

The problem is the single array in struct cadef. In effect this gets
overloaded for both + and - options. For both -d and +d, we look up the
entry with 'd' in unsigned form as the index. A quick hack to add 128 to
the index for + options appears to fix the issues you list.

But I wonder whether we should go for a somewhat different approach.
Instead of: d->single[STOUC(*line) + (pre == '-' ? 0 : 128)]
Have a macro for: d->single[SINGLEIDX(*line, pre)]
Allowing 256 entries was simple and efficient before multibyte character
sets was an issue. I don't think there is any point supporting
clumping of options that use non-ASCII characters. So the single array
doesn't need to be a hash or list. It could even be smaller if we skip
populating it for control characters in addition to those with the high
bit set.

Any thoughts?

Oliver

  reply	other threads:[~2020-03-01 21:38 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-12 22:57 dana
2020-03-01 21:36 ` Oliver Kiddle [this message]
2020-03-02  6:04   ` dana
2021-10-22 19:50 ` Oliver Kiddle

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=73158-1583098615.557435@POT1.7-E-.0MVN \
    --to=okiddle@yahoo.co.uk \
    --cc=dana@dana.is \
    --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).