zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: "Zsh Hackers' List" <zsh-workers@zsh.org>
Subject: Re: Bug somewhere in verbose output for completion listing
Date: Thu, 03 Oct 2013 21:01:51 -0700	[thread overview]
Message-ID: <131003210151.ZM3277@torch.brasslantern.com> (raw)
In-Reply-To: <20131003172007.57e1e825@pwslap01u.europe.root.pri>

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.


      parent reply	other threads:[~2013-10-04  4:01 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-03 13:00 Peter Stephenson
2013-10-03 13:32 ` Peter Stephenson
2013-10-03 22:54   ` Bart Schaefer
2013-10-03 14:50 ` Bart Schaefer
2013-10-03 15:09   ` Bart Schaefer
2013-10-03 16:19     ` Bart Schaefer
2013-10-03 16:20     ` Peter Stephenson
2013-10-03 16:34       ` Peter Stephenson
2013-10-04  4:01       ` Bart Schaefer [this message]

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=131003210151.ZM3277@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --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).