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

Re: Bug somewhere in verbose output for completion listing



A final thought.

On Oct 3,  5:20pm, Peter Stephenson wrote:
}
} so premaxw has gone up.  Sure enough it doesn't get reset with most of the
} other stuff in cd_init(), and I can't see any reason why it shouldn't
} be.  It must start off initially at 0 so resetting it to 0 each time
} we initialise the state can't make anything worse (theoretically).

We're now back to the state that Felipe Contreras complained about in
the earlier thread that I referenced:

torch% _foobar ()            
{
    local -a commands extra
    commands=('one:command one' 'two:command two')
    _describe -t commands 'commands' commands
    extra=('extraone:extra command one'
	   'zbiggertoshowthealignissue:extra command two')  
    _describe -t extra 'extra' extra
}
torch% compdef _foobar foobar
torch% foobar
extraone                    -- extra command one
one  -- command one
two  -- command two
zbiggertoshowthealignissue  -- extra command two
torch% 

This happens because there are two calls to _describe for the different
groups, and each call to _describe calls compdescribe -I which then
resets the maximum width.  (Previously it would look strange like this
the first time you tried it, and then [because premaxw was NOT reset]
they would all line up on the widest stance on subsequent attempts.
Now at least it's consistently "mis-aligned" every time.)

The behavior looks a little better if you sort the matches by group:

torch% zstyle :completion:\* group-name ''
torch% foobar
one  -- command one
two  -- command two
extraone                    -- extra command one
zbiggertoshowthealignissue  -- extra command two

To add a bit to the discussion from the previous thread, this is as it
is because the entire "one  -- command one" (et al.) is assembled as a
single string by compdescribe.  The data structure does not store pairs
of (match,description) that can be realigned upon display.



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