Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Alignment issue with multiple describes
On Sun, Apr 21, 2013 at 1:27 PM, Bart Schaefer
<schaefer@xxxxxxxxxxxxxxxx> wrote:
> On Apr 21, 3:31am, Felipe Contreras wrote:
> }
> } > That you've chosen not to display the groups separately doesn't mean
> } > they aren't grouped internally.
> }
> } Well, I didn't choose it, that's the way it is by default.
>
> Yes, so that a simple zstyle setting can be used to alter display order,
> rather than having to rewrite the shell functions.
I cannot change the zstyle setting of everyone in the world. Also,
there's no zstyle setting that does the right thing, actually. If you
have one, please, let me know which is it. From what I can see, they
all throw buggy output.
> } That is indeed very interesting, but to me, it's a bug that the output
> } of the first completion is not the same as the second. And that it
> } also depends on the order of the _describe commands. The completion
> } clearly waits until all the _describe commands have been issued, and
> } then renders them (ordered), so couldn't this maximum width be
> } calculated at that point?
>
> No. The display layout is calculated as each group is created and is
> stored with the data structures. The render-time code is relatively
> dumb (except for all the smarts about manipulating the terminal device
> for coloring and so on) and just spits out what the data structures say.
> As far as I can tell (and I'm by no means the person most familar with
> this code [*]) the layout of each group is calculated without reference
> to the other groups except for static globals that keep track of the
> widest column from any group encountered so far.
It should still be possible to traverse the groups, calculate the
widest column, store it globally, and _then_ do the layout
calculation. Even better would be to not do the column width at the
layout calculation level, but simply divide by columns, and let the
render-time code or some higher level function with knowledge of
multiple groups determine the width.
It doesn't matter how it's done, as long as the bug is fixed.
> [*] Unfortunately the person most familiar with this code has not been
> active in zsh development for 12 years. On the other hand, it's been
> 12 years and you're the first person ever to notice/mention this, so it
> probably doesn't affect anyone's usage of the shell.
It probably does, but nobody cares enough about subtle bugs in zsh.
Specially since most completions don't use more than one _description,
the git completion being one exception.
Anyway, I'm going to label this as a bug the zsh developers are
unwilling to fix, and I'm going to work around it by avoiding more
than one _description with actual descriptions.
And BTW, the fact that you have part of the code nobody understands,
has touched, or is willing to touch in a decade should be a concern to
you. And so should be the decreasing year-over-year contributions and
commits:
https://www.ohloh.net/p/zsh/commits/summary
I would say this is a sign that you should reconsider your development
practices. But whatever, keep going the way you are going if you want.
Cheers.
--
Felipe Contreras
Messages sorted by:
Reverse Date,
Date,
Thread,
Author