zsh-workers
 help / color / mirror / code / Atom feed
From: Daniel Shahaf <d.s@daniel.shahaf.name>
To: zsh-workers@zsh.org
Subject: Re: [PATCH] _postfix (postconf): Complete only applicable parameters for -X and -#.
Date: Thu, 15 Sep 2016 04:48:55 +0000	[thread overview]
Message-ID: <20160915044855.GA22306@fujitsu.shahaf.local2> (raw)
In-Reply-To: <160914203506.ZM32505@torch.brasslantern.com>

Bart Schaefer wrote on Wed, Sep 14, 2016 at 20:35:06 -0700:
> On Sep 15,  2:15am, Daniel Shahaf wrote:
> } Subject: Re: [PATCH] _postfix (postconf): Complete only applicable paramet
> }
> } The prompt says:
> } 
> }     zsh: do you wish to see all 112 possibilities (28 lines)?
> } 
> } If I answer "yes" then I get 28 lines, that show everything in my
> } `postconf -n` output and nothing else:
> 
> And how many words is that, all together?  I think it must be counting
> the words in the descriptions as "possibilities" which probably has
> something to do with the way the column positions are abused to get
> the description to line up nicely alongside the thing described.

Bingo.  I see it now.  My 'postconf -n' has:

- 1 value that repeats 3 times
- 2 values that repeat twice, each
- 25 values that appear once each

So _describe puts that into a table as follows:

a1  a2  a3  -- va
b1  b2      -- vb
c1  c2      -- vc
k1          -- v1
k2          -- v2
⋮
k25         -- v25

The table has 4 columns — headed by "a1", "a2", "a3", and "-- v1" where
the double-hyphen is the list-separator style — and 28 rows, so it
counts as 28×4 = 112 matches.

Here's a reproducer:

_f () {
	a=( )
	i=25
	while (( i-- )
	do
		a+=( k${i}:v$i )
	done
	a+=( a{1..3}:va b{1..2}:vb c{1..2}:vc )
	a=( ${a/:/_______________________:} )
	_describe d a
}


      reply	other threads:[~2016-09-15  4:49 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-14  5:14 Daniel Shahaf
2016-09-14 16:46 ` Bart Schaefer
2016-09-15  2:15   ` Daniel Shahaf
2016-09-15  3:35     ` Bart Schaefer
2016-09-15  4:48       ` Daniel Shahaf [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=20160915044855.GA22306@fujitsu.shahaf.local2 \
    --to=d.s@daniel.shahaf.name \
    --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).