zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Felipe Contreras <felipe.contreras@gmail.com>, zsh-workers@zsh.org
Subject: Re: Alignment issue with multiple describes
Date: Sat, 20 Apr 2013 23:27:40 -0700	[thread overview]
Message-ID: <130420232740.ZM12405@torch.brasslantern.com> (raw)
In-Reply-To: <CAMP44s1WDkUiwsj1dzW6icUVFq4-noqEDKRS0k3AePxo1Oj6nA@mail.gmail.com>

On Apr 20, 10:03pm, Felipe Contreras wrote:
}
} I've noticed a problem when using more than one
} describe: the completion's description is aligned, but only to the
} same description, even if they are not grouped.

In part the issue here is that they *are* grouped, implicitly, as you
can see here:

schaefer<504> foobar
Completing commands
one  -- command one
two  -- command two
Completing extra
extraone                    -- extra command one
zbiggertoshowthealignissue  -- extra command two

That you've chosen not to display the groups separately doesn't mean
they aren't grouped internally.

Curiously, though, the above happens for me only the very first time that
the completion is tried.  Here's my second try:

schaefer<504> foobar
Completing commands
one                         -- command one
two                         -- command two
Completing extra
extraone                    -- extra command one
zbiggertoshowthealignissue  -- extra command two

There's no difference in shell code executed (_complete_debug output), so
the whole problem seems to hinge on whether compadd has been invoked at
least once before.  As a third example, if I complete after "ls --" to
force a long list of options, and then complete after foobar, I get this:

schaefer<504> foobar
Completing commands
one                                        -- command one
two                                        -- command two
Completing extra
extraone                                   -- extra command one
zbiggertoshowthealignissue                 -- extra command two

Note that the alignment is "correct" but with a lot more whitespace
than the previous "correct" display.

This is ringing a very distant bell.  I think that in order to get the
alignment right, you have to be sure to compadd [and thus _describe]
the longest strings first; compadd has no way of knowing how many
groups there will be, and can't go back and fix up a previous group
when aligning a new one, but it does remember the greatest length it
has seen in all groups so far, and aligns everything against that.

Leaking that length across separate ZLE passes, as appears to be the
case with completing for "ls" first, is probably a bug -- something
should be getting reset on zle entry or exit, but is not.


  parent reply	other threads:[~2013-04-21  6:27 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-21  3:03 Felipe Contreras
2013-04-21  3:03 ` Felipe Contreras
2013-04-21  6:27 ` Bart Schaefer [this message]
2013-04-21  8:31   ` Felipe Contreras
2013-04-21 18:27     ` Bart Schaefer
2013-04-21 20:59       ` Felipe Contreras
2013-04-21 21:09         ` Mikael Magnusson
2013-04-21 22:00         ` Felipe Contreras
2013-04-22  6:59         ` Bart Schaefer
2013-04-22  7:30           ` Felipe Contreras

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=130420232740.ZM12405@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=felipe.contreras@gmail.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).