Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [BUG] Issue with _arguments !-x !+x



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



Messages sorted by: Reverse Date, Date, Thread, Author